消息群发

文本消息

  1. message := "hello, broadcasting test..."
  2. OfficialAccountApp.Broadcasting.SendText(message, &request.Reception{
  3. ToUser: []string{"[openID]"},
  4. Filter: &request.Filter{
  5. IsToAll: false,
  6. TagID: 0,
  7. },
  8. }, &power.HashMap{})

微信官方文档

图文消息

  1. mediaID := ""
  2. OfficialAccountApp.Broadcasting.SendNews(ctx,mediaID, &request.Reception{
  3. ToUser: []string{"[openID]"},
  4. Filter: &request.Filter{
  5. IsToAll: false,
  6. TagID: 0,
  7. },
  8. }, &power.HashMap{})

微信官方文档

图片消息

  1. mediaID := ""
  2. OfficialAccountApp.Broadcasting.SendImage(ctx,mediaID, &request.Reception{
  3. ToUser: []string{"[openID]"},
  4. Filter: &request.Filter{
  5. IsToAll: false,
  6. TagID: 0,
  7. },
  8. }, &power.HashMap{})

微信官方文档

语音消息

  1. mediaID := ""
  2. OfficialAccountApp.Broadcasting.SendVoice(ctx,mediaID, &request.Reception{
  3. ToUser: []string{"[openID]"},
  4. Filter: &request.Filter{
  5. IsToAll: false,
  6. TagID: 0,
  7. },
  8. }, &power.HashMap{})

微信官方文档

视频消息

  1. mediaID := ""
  2. OfficialAccountApp.Broadcasting.SendVideo(ctx,mediaID, &request.Reception{
  3. ToUser: []string{"[openID]"},
  4. Filter: &request.Filter{
  5. IsToAll: false,
  6. TagID: 0,
  7. },
  8. }, &power.HashMap{})

微信官方文档

卡劵消息

  1. mediaID := ""
  2. OfficialAccountApp.Broadcasting.SendCard(ctx,mediaID, &request.Reception{
  3. ToUser: []string{"[openID]"},
  4. Filter: &request.Filter{
  5. IsToAll: false,
  6. TagID: 0,
  7. },
  8. }, &power.HashMap{})

微信官方文档

发送预览群发消息给指定的 openId 用户

  1. message := ""
  2. data, err := services.OfficialAccountApp.Broadcasting.PreviewText(ctx,message, &request.Reception{
  3. ToUser: []string{"[openID]"},
  4. Filter: &request.Filter{
  5. IsToAll: false,
  6. TagID: 0,
  7. },
  8. }, "")

微信官方文档

发送预览群发消息给指定的微信号用户

文档正在完善中…

删除群发消息

  1. OfficialAccountApp.Broadcasting.Delete(ctx,"[msgID]", 0)

微信官方文档

查询群发消息发送状态

  1. OfficialAccountApp.Broadcasting.Status(ctx,"[msgID]")

微信官方文档

使用示例

参考: PowerWechatTutorial