微信分组群发图文40152,微信分组群发图文invalid group id hint

微信分组群发40152,微信分组群发invalid group id hint

?

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.

蕃薯耀 2016年5月18日 11:28:12 星期三

http://fanshuyao.iteye.com/

?

一、问题描述:

微信分组群发图文消息给所有人,即:"is_to_all":true

?

返回如下结果

?

{"errcode":40152,"errmsg":"invalid group id hint: [ZjMwHa0887ge11]"}    

?invalid group id hint的意思是:无效的分组id

?

但官方文档是这样说的:group_id是可以为空的。而实际上是需要的。但这个问题只出现在图文?因为文字消息是可以用的(在下面有补充)

参数 是否必须 说明
filter 用于设定图文消息的接收者
is_to_all 用于设定是否向全部用户发送,值为true或false,选择true该消息群发给所有用户,选择false可根据group_id发送给指定群组的用户
group_id 群发到的分组的group_id,参加用户管理中用户分组接口,若is_to_all值为true,可不填写group_id
mpnews 用于设定即将发送的图文消息
media_id 用于群发的消息的media_id
msgtype 群发的消息类型,图文消息为mpnews,文本消息为text,语音为voice,音乐为music,图片为image,视频为video,卡券为wxcard
title 消息的标题
description 消息的描述
thumb_media_id 视频缩略图的媒体ID

?

?

测试文字消息推送

?

Java方法:

/**
	 * 推送文字消息给所有用户
	 * @param content 内容
	 * @return
	 */
	public static String getSendTextJsonToAll(String content){
		StringBuffer sb = new StringBuffer("");
		sb.append("{").
		append("\"filter\":{").
		append("\"is_to_all\":true").
		append("},").
		append("\"text\":{").
		append("\"content\":\"").append(content).append("\"").
		append("},").
		append("\"msgtype\":\"text\"").
		append("}");
		return sb.toString();
	}

?

?返回的json字符串:

{
    "filter":{
        "is_to_all":true
    },
    "text":{
        "content":"测试微信群发消息:今天是2016-05-18,星期三,天气是多云,晚上有点冷,需要适当穿戴衣物。Have a good day!"
    },
    "msgtype":"text"
}

?

推送结果是成功的。

?

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.

蕃薯耀 2016年5月18日 11:28:12 星期三

http://fanshuyao.iteye.com/

文章来自:http://fanshuyao.iteye.com/blog/2298995
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3