微信公众号开发中图文消息推送报错"{"errcode":48008,"errmsg":"no permission for this msgtype hint: [hDBAwa0376ge20]"}"
2018-03-13 11:06
1876 查看
如果出现此报错,那么说明你的公众号没有被允许使用该功能的权限.
首先要确定你的现在使用的微信公众号 认证没有,有认证的一般能正常使用该功能,如果没有认证就是普通的服务号,用不了该功能.
不过可以使用测试号(每个服务号都能免费申请一个) 使用该功能,但是测试号的图文群发 功能只能是发送到你在代码中设定的openid预览,不能实现全部群发.
所以如果你是测试号,而编写是全部群发的代码,那么这样就会报这个错.
以下是测试号实现图文消息预览的代码:
//预览模板
$url_pre = "https://api.weixin.qq.com/cgi-bin/message/mass/preview?access_token=".$access_token;
$post_pre = '{
"touser":"你想要推送到那个用户的openid",
"mpnews":{
"media_id":"'.$media_id.'"
},
"msgtype":"mpnews"
}';
而如果是认证号,可以是实现真正的群发,参考代码如下:
$post_news ='{
"filter":{
"is_to_all":true,
"tag_id":2
},
"mpnews":{
"media_id":"'.$media_id.'"
},
"msgtype":"mpnews",
"send_ignore_reprint":1
}';
$url_news ="https://api.weixin.qq.com/cgi-bin/message/mass/sendall?access_token=".$access_token;
首先要确定你的现在使用的微信公众号 认证没有,有认证的一般能正常使用该功能,如果没有认证就是普通的服务号,用不了该功能.
不过可以使用测试号(每个服务号都能免费申请一个) 使用该功能,但是测试号的图文群发 功能只能是发送到你在代码中设定的openid预览,不能实现全部群发.
所以如果你是测试号,而编写是全部群发的代码,那么这样就会报这个错.
以下是测试号实现图文消息预览的代码:
//预览模板
$url_pre = "https://api.weixin.qq.com/cgi-bin/message/mass/preview?access_token=".$access_token;
$post_pre = '{
"touser":"你想要推送到那个用户的openid",
"mpnews":{
"media_id":"'.$media_id.'"
},
"msgtype":"mpnews"
}';
而如果是认证号,可以是实现真正的群发,参考代码如下:
$post_news ='{
"filter":{
"is_to_all":true,
"tag_id":2
},
"mpnews":{
"media_id":"'.$media_id.'"
},
"msgtype":"mpnews",
"send_ignore_reprint":1
}';
$url_news ="https://api.weixin.qq.com/cgi-bin/message/mass/sendall?access_token=".$access_token;
相关文章推荐
- php微信开发解决{"errcode":40016,"errmsg":"invalid button size hint: [pqd5ea0809vr22]"}
- 微信公众号开发--上传图片“errcode":41005,"errmsg":"media data missing”错误解决方法 "errcode":41005,"errmsg":"media dat
- Java企业微信开发_Exception_01_"errcode":60011,"errmsg":"no privilege to access/modify contact/party/agent "
- 微信公众号开发上传零时素材遇到"errcode":41005,"errmsg":"media data missing
- 微信高级群发接口 {"errcode":40008,"errmsg":"invalid message type hint: [aRIDBA0726age9]"}
- Spring AOP 开发中遇到问题:Caused by: java.lang.IllegalArgumentException: warning no match for this type name: com.xxx.collector.service.impl.XxxServiceImpl [Xlint:invalidAbsoluteTypeName]
- Java微信开发_Exception_02_"errcode":40164,"errmsg":"invalid ip 61.172.68.219, not in whitelist hint
- 记录bug:公众号发送模板消息指向小程序时返回错误:{"errcode":40165,"errmsg":"invalid weapp pagepath hint: [bsAWua0201ge30]"}
- 微信公众号接口开发:新增临时素材{"errcode":41005,"errmsg":"media data missing"}
- 微信公众号开发---上传临时素材到公众号遇到的问题:"errcode":41005,"errmsg":"media data missing
- 微信公众号开发上传零时素材遇到"errcode":41005,"errmsg":"media data missing
- WindowManager$BadTokenException: Unable to add window permission denied for this window type
- The breakpoint will not currently be hit. No symbols have been loaded for this document."
- WindowManager$BadTokenException: Unable to add window permission denied for this window type
- 【iOS开发】-canOpenURL: failed for URL: "xx" - error:"This app is not allowed to query for scheme xx"
- 转:Debugger problem "The breakpoint will not currently be hit. No symbols have been loaded for this document“
- Android AVD出现"No system images installed for this target"
- JAVA微信公众号开发第3篇客服图文消息
- {"errcode":40054,"errmsg":"invalid sub button url domain hint: [WWA480339vr20]的解决办法
- Android开发时,提示no resource for "theme......."in package "android"