微信企业号开发调用发送消息接口报错:"errcode":82001,"errmsg":"All touser & toparty & totag invalid"
接口:https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=ACCESS_TOKEN
82001:发送消息或者邀请的参数全部为空或者全部不合法
解决方案:
1、添加通讯录的权限(开发时已设置应用的权限了,所以此项没有验证过)
2、发送的消息json格式不对,如touser写成了toUser,微信接口在传达数据时是区分大消息的
正确格式:
{ "touser": "UserID1|UserID2|UserID3", "toparty": " PartyID1 | PartyID2 ", "totag": " TagID1 | TagID2 ", "msgtype": "text", "agentid": 1, "text": { "content": "Holiday Request For Pony(http://xxxxx)" }, "safe":"0" }
错误格式
{ "toUser": "UserID1|UserID2|UserID3", "toparty": " PartyID1 | PartyID2 ", "totag": " TagID1 | TagID2 ", "msgtype": "text", "agentid": 1, "text": { "content": "Holiday Request For Pony(http://xxxxx)" }, "safe":"0" }