http://qydev./wiki/index.php?title=%E5%8F%91%E9%80%81%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E
请求说明
Https请求方式: POST
https://qyapi./cgi-bin/message/send?access_token=ACCESS_TOKEN
消息型应用支持文本、图片、语音、视频、文件、图文等消息类型。主页型应用只支持文本消息类型,且文本长度不超过20个字。
参数说明
权限说明
收件人必须处于应用的可见范围内,并且管理组对应用有使用权限、对收件人有查看权限,否则本次调用失败。
返回结果
如果无权限或收件人不存在,则本次发送失败,返回无效的userid列表(注:由于userid不区分大小写,返回的列表都统一转为小写);如果未关注,发送仍然执行。
{"errcode":0,"errmsg":"ok","invaliduser":"UserID1","invalidparty":"PartyID1","invalidtag":"TagID1"}
http://qydev./wiki/index.php?title=%E6%B6%88%E6%81%AF%E7%B1%BB%E5%9E%8B%E5%8F%8A%E6%95%B0%E6%8D%AE%E6%A0%BC%E5%BC%8F
目录
1text消息
2p_w_picpath消息
3voice消息
4video消息
5file消息
6news消息
7mpnews消息
text消息
{"touser":"UserID1|UserID2|UserID3","toparty":"PartyID1|PartyID2","totag":"TagID1|TagID2","msgtype":"text","agentid":1,"text":{"content":"HolidayRequestForPony(http://xxxxx)"},"safe":0}
p_w_picpath消息
{"touser":"UserID1|UserID2|UserID3","toparty":"PartyID1|PartyID2","totag":"TagID1|TagID2","msgtype":"p_w_picpath","agentid":1,"p_w_picpath":{"media_id":"MEDIA_ID"},"safe":0}
voice消息
{"touser":"UserID1|UserID2|UserID3","toparty":"PartyID1|PartyID2","totag":"TagID1|TagID2","msgtype":"voice","agentid":1,"voice":{"media_id":"MEDIA_ID"},"safe":0}
video消息
{"touser":"UserID1|UserID2|UserID3","toparty":"PartyID1|PartyID2","totag":"TagID1|TagID2","msgtype":"video","agentid":1,"video":{"media_id":"MEDIA_ID","title":"Title","description":"Description"},"safe":0}
file消息
{"touser":"UserID1|UserID2|UserID3","toparty":"PartyID1|PartyID2","totag":"TagID1|TagID2","msgtype":"file","agentid":1,"file":{"media_id":"MEDIA_ID"},"safe":"0"}
news消息
{"touser":"UserID1|UserID2|UserID3","toparty":"PartyID1|PartyID2","totag":"TagID1|TagID2","msgtype":"news","agentid":1,"news":{"articles":[{"title":"Title","description":"Description","url":"URL","picurl":"PIC_URL"},{"title":"Title","description":"Description","url":"URL","picurl":"PIC_URL"}]}}
mpnews消息
注:mpnews消息与news消息类似,不同的是图文消息内容存储在微信后台,并且支持保密选项。每个应用每天最多可以发送100次。
a)发送时直接带上mpnews内容:
{"touser":"UserID1|UserID2|UserID3","toparty":"PartyID1|PartyID2","totag":"TagID1|TagID2","msgtype":"mpnews","agentid":1,"mpnews":{"articles":[{"title":"Title","thumb_media_id":"id","author":"Author","content_source_url":"URL","content":"Content","digest":"Digestdescription","show_cover_pic":"0"},{"title":"Title","thumb_media_id":"id","author":"Author","content_source_url":"URL","content":"Content","digest":"Digestdescription","show_cover_pic":"0"}]},"safe":0}
b)发送时使用永久图文素材ID:
{"touser":"UserI1|UserID2|UserID3","toparty":"PartyID1|PartyID2","msgtype":"mpnews","agentid":1,"mpnews":{"media_id":"MEDIA_ID"},"safe":0}