wechatapi--微信ipad协议--消息模块开发

34 阅读32分钟

默认模块

Base URLs: wechatapi.net

Authentication

开发API/消息模块

POST 发送文字消息

POST /message/postText

注意

在群内发送消息@某人时,content中需包含@xxx

Body 请求参数

{
  "appId": "{{appid}}",
  "toWxid": "5648**750@chatroom",
  "ats": "wxid_muvqvs*j0522,wxid_fgagnu*4ne22,wxid_tcv*iqia3121,The-*BeHour",
  "content": "@11 @22 @33test123"
}

请求参数

名称位置类型必选说明
VideosApi-tokenheaderstringnone
bodybodyobjectnone
» appIdbodystring设备ID
» toWxidbodystring好友/群的ID
» contentbodystring消息内容
» atsbodystring@的好友,多个英文逗号分隔。群主或管理员@全部的人,则填写'notify@all'

返回示例

200 Response

{
  "ret": 200,
  "msg": "操作成功",
  "data": {
    "toWxid": "***********@chatroom",
    "createTime": 1703841160,
    "msgId": 0,
    "newMsgId": 3768973957878705000,
    "type": 1
  }
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» retintegertruenonenone
» msgstringtruenonenone
» dataobjecttruenonenone
»» toWxidstringtruenone接收人的wxid
»» createTimeintegertruenone发送时间
»» msgIdintegertruenone消息ID
»» newMsgIdintegertruenone消息ID
»» typeintegertruenone消息类型

POST 发送文件消息

POST /message/postFile

Body 请求参数

{
  "appId": "{{appid}}",
  "toWxid": "***********@chatroom",
  "fileName": "a909.xls",
  "fileUrl": "https://scrm-1308498490.cos.ap-shanghai.myqcloud.com/pkg/a909-99066ce80e03.xls?q-sign-algorithm=sha1&q-ak=AKIDmOkqfDUUDfqjMincBSSAbleGaeQv96mB&q-sign-time=1703841209;1703848409&q-key-time=1703841209;1703848409&q-header-list=&q-url-param-list=&q-signature=2a60b0f8d9169550cd83c4a3ca9cd18138b4bb88"
}

请求参数

名称位置类型必选说明
VideosApi-tokenheaderstringnone
bodybodyobjectnone
» appIdbodystring设备ID
» toWxidbodystring好友/群的ID
» fileUrlbodystring文件链接
» fileNamebodystring文件名

返回示例

200 Response

{
  "ret": 200,
  "msg": "操作成功",
  "data": {
    "toWxid": "***********@chatroom",
    "createTime": 1703841225,
    "msgId": 769523509,
    "newMsgId": 4399037329770756000,
    "type": 6
  }
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» retintegertruenonenone
» msgstringtruenonenone
» dataobjecttruenonenone
»» toWxidstringtruenone接收人的wxid
»» createTimeintegertruenone发送时间
»» msgIdintegertruenone消息ID
»» newMsgIdintegertruenone消息ID
»» typeintegertruenone消息类型

POST 发送图片消息

POST /message/postImage

注意

发送图片接口会返回cdn相关的信息,如有需求同一张图片发送多次,第二次及以后发送时可使用接口返回的cdn信息拼装xml调用转发图片接口,这样可以缩短发送时间

Body 请求参数

{
  "appId": "{{appid}}",
  "toWxid": "*********@chatroom",
  "imgUrl": "http://dummyimage.com/400x400"
}

请求参数

名称位置类型必选说明
VideosApi-tokenheaderstringnone
bodybodyobjectnone
» appIdbodystring设备ID
» toWxidbodystring好友/群的ID
» imgUrlbodystring图片链接

返回示例

200 Response

{
  "ret": 200,
  "msg": "操作成功",
  "data": {
    "toWxid": "*********@chatroom",
    "createTime": 0,
    "msgId": 640355969,
    "newMsgId": 8992614056172360000,
    "type": null,
    "aesKey": "7678796e6d70626e6b626c6f7375616b",
    "fileId": "3052020100044b30490201000204e49785f102033d11fd0204136166b4020465966eea042437646265323234362d653662662d343464392d39336*********13661363863646266390204052418020201000400",
    "length": 1096,
    "width": 400,
    "height": 400,
    "md5": "e6355eab0393facbd6a2cde3f990ef60"
  }
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» retintegertruenonenone
» msgstringtruenonenone
» dataobjecttruenonenone
»» toWxidstringtruenone接收人的wxid
»» createTimeintegertruenone发送时间
»» msgIdintegertruenone消息ID
»» newMsgIdintegertruenone消息ID
»» typenulltruenone消息类型
»» aesKeystringtruenonecdn相关的aeskey
»» fileIdstringtruenonecdn相关的fileid
»» lengthintegertruenone图片文件大小
»» widthintegertruenone图片宽度
»» heightintegertruenone图片高度
»» md5stringtruenone图片md5

POST 发送语音消息

POST /message/postVoice

Body 请求参数

{
  "appId": "{{appid}}",
  "toWxid": "*********@chatroom",
  "voiceUrl": "https://scrm-1308498490.cos.ap-shanghai.myqcloud.com/pkg/response.silk?q-sign-algorithm=sha1&q-ak=AKIDmOkqfDUUDfqjMincBSSAbleGaeQv96mB&q-sign-time=1703841529;1703848729&q-key-time=1703841529;1703848729&q-header-list=&q-url-param-list=&q-signature=781831fe71ad4bbb582715bf197a9cf86ec80c97",
  "voiceDuration": 2000
}

请求参数

名称位置类型必选说明
VideosApi-tokenheaderstringnone
bodybodyobjectnone
» appIdbodystring设备ID
» toWxidbodystring好友/群的ID
» voiceUrlbodystring语音文件的链接,仅支持silk格式
» voiceDurationbodyinteger语音时长,单位毫秒

返回示例

200 Response

{
  "ret": 200,
  "msg": "操作成功",
  "data": {
    "toWxid": "*********@chatroom",
    "createTime": 1704357563,
    "msgId": 640355967,
    "newMsgId": 2321462558768366600,
    "type": null
  }
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» retintegertruenonenone
» msgstringtruenonenone
» dataobjecttruenonenone
»» toWxidstringtruenone接收人的wxid
»» createTimeintegertruenone发送时间
»» msgIdintegertruenone消息ID
»» newMsgIdintegertruenone消息ID
»» typeintegertruenone消息类型

POST 发送视频消息

POST /message/postVideo

注意

发送视频接口会返回cdn相关的信息,如有需求同一个视频发送多次,第二次及以后发送时可使用接口返回的cdn信息拼装xml调用转发视频接口,这样可以缩短发送时间

Body 请求参数

{
  "appId": "{{appid}}",
  "toWxid": "**********@chatroom",
  "videoUrl": "https://scrm-1308498490.cos.ap-shanghai.myqcloud.com/pkg/436fa030-18a45a6e917.mp4?q-sign-algorithm=sha1&q-ak=AKIDmOkqfDUUDfqjMincBSSAbleGaeQv96mB&q-sign-time=1703841673;1703848873&q-key-time=1703841673;1703848873&q-header-list=&q-url-param-list=&q-signature=2527904720ee07fd5bfc6cfffa001b415fd08329",
  "thumbUrl": "https://scrm-1308498490.cos.ap-shanghai.myqcloud.com/pkg/hhh.jpeg?q-sign-algorithm=sha1&q-ak=AKIDmOkqfDUUDfqjMincBSSAbleGaeQv96mB&q-sign-time=1703841885;1703849085&q-key-time=1703841885;1703849085&q-header-list=&q-url-param-list=&q-signature=c0a3837bde236636c342373e19551e332c40d847",
  "videoDuration": 10
}

请求参数

名称位置类型必选说明
VideosApi-tokenheaderstringnone
bodybodyobjectnone
» appIdbodystring设备ID
» toWxidbodystring好友/群的ID
» videoUrlbodystring视频的链接
» thumbUrlbodystring缩略图的链接
» videoDurationbodyinteger视频的播放时长,单位秒

返回示例

200 Response

{
  "ret": 200,
  "msg": "操作成功",
  "data": {
    "toWxid": "**********@chatroom",
    "createTime": null,
    "msgId": 769523567,
    "newMsgId": 945590746179451500,
    "type": null,
    "aesKey": "687a636f627579667a756a7168717968",
    "fileId": "3052020100044b304902010002043904752002033d11ff02045dd79b240204658e9072042466633131376136662d366566632d343638662d613633662d3536316139616133383362350204012400040201000400",
    "length": 1315979
  }
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» retintegertruenonenone
» msgstringtruenonenone
» dataobjecttruenonenone
»» toWxidstringtruenone接收人的wxid
»» createTimenulltruenone发送时间
»» msgIdintegertruenone消息ID
»» newMsgIdintegertruenone消息ID
»» typenulltruenone消息类型
»» aesKeystringtruenonecdn相关的aeskey
»» fileIdstringtruenonecdn相关的fileid
»» lengthintegertruenone视频文件大小

POST 发送链接消息

POST /message/postLink

Body 请求参数

{
  "appId": "{{appid}}",
  "toWxid": "**********@chatroom",
  "title": "澳门这一夜",
  "desc": "39岁郭碧婷用珠圆玉润的身材,狠狠打脸了白幼瘦女星",
  "linkUrl": "https://mbd.baidu.com/newspage/data/landingsuper?context=%7B%22nid%22%3A%22news_8864265500294006781%22%7D&n_type=-1&p_from=-1",
  "thumbUrl": "https://pics3.baidu.com/feed/0824ab18972bd407a9403f336648d15c0db30943.jpeg@f_auto?token=d26f7f142871542956aaa13799ba1946"
}

请求参数

名称位置类型必选说明
VideosApi-tokenheaderstringnone
bodybodyobjectnone
» appIdbodystring设备ID
» toWxidbodystring好友/群的ID
» titlebodystring链接标题
» descbodystring链接描述
» linkUrlbodystring链接地址
» thumbUrlbodystring链接缩略图地址

返回示例

200 Response

{
  "ret": 200,
  "msg": "操作成功",
  "data": {
    "toWxid": "*********@chatroom",
    "createTime": 1703841982,
    "msgId": 769523572,
    "newMsgId": 3358797740318931000,
    "type": 5
  }
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» retintegertruenonenone
» msgstringtruenonenone
» dataobjecttruenonenone
»» toWxidstringtruenone接收人的wxid
»» createTimeintegertruenone发送时间
»» msgIdintegertruenone消息ID
»» newMsgIdintegertruenone消息ID
»» typeintegertruenone消息类型

POST 发送名片消息

POST /message/postNameCard

Body 请求参数

{
  "appId": "{{appid}}",
  "toWxid": "*****@chatroom",
  "nickName": "苏生-服务支持",
  "nameCardWxid": "wxid_*****7522"
}

请求参数

名称位置类型必选说明
VideosApi-tokenheaderstringnone
bodybodyobjectnone
» appIdbodystring设备ID
» toWxidbodystring好友/群的ID
» nickNamebodystring名片的昵称
» nameCardWxidbodystring名片的wxid

返回示例

200 Response

{
  "ret": 200,
  "msg": "操作成功",
  "data": {
    "toWxid": "34757816141@chatroom",
    "createTime": 1703842036,
    "msgId": 0,
    "newMsgId": 3285058507819179500,
    "type": 42
  }
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» retintegertruenonenone
» msgstringtruenonenone
» dataobjecttruenonenone
»» toWxidstringtruenone接收人的wxid
»» createTimeintegertruenone发送时间
»» msgIdintegertruenone消息ID
»» newMsgIdintegertruenone消息ID
»» typeintegertruenone消息类型

POST 发送定位置消息

POST /message/postLocation

本接口为发送/转发定位消息,使用回调中XML数据 可保存结构,修改经度纬度,label,poiname

Body 请求参数

{
  "appId": "wx_wLCyJbw5J******wvy",
  "toWxid": "wxid_krcc*****hbj22",
  "content": "<msg>\n\t<location x=\"34.283573\" y=\"117.188789\" scale=\"15\" label=\"鼓楼区南京路\" maptype=\"0\" poiname=\"鼓楼区雨花台(详细地址)\" poiid=\"nearby_792894707970093245\" buildingId=\"\" floorName=\"\" poiCategoryTips=\"\" poiBusinessHour=\"\" poiPhone=\"\" poiPriceTips=\"0.0\" isFromPoiList=\"false\" adcode=\"\" cityname=\"\" />\n</msg>"
}

请求参数

名称位置类型必选说明
VideosApi-tokenheaderstringnone
bodybodyobjectnone
» appIdbodystring设备ID
» toWxidbodystring好友/群的ID
» contentbodystring回调消息中的content节点内容

返回示例

200 Response

{
  "ret": 200,
  "msg": "操作成功",
  "data": {
    "toWxid": "wxid_krcc*****hbj22",
    "createTime": 1703842453,
    "msgId": 769523712,
    "newMsgId": 3090682956820882400,
    "type": 0
  }
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» retintegertruenonenone
» msgstringtruenonenone
» dataobjecttruenonenone
»» toWxidstringtruenone接收人的wxid
»» createTimeintegertruenone发送时间
»» msgIdintegertruenone消息ID
»» newMsgIdintegertruenone消息ID
»» typeintegertruenone消息类型

POST 发送emoji消息

POST /message/postEmoji

Body 请求参数

{
  "appId": "{{appid}}",
  "toWxid": "***********@chatroom",
  "emojiMd5": "4cc7540a85b5b6cf4ba14e9f4ae08b7c",
  "emojiSize": 102357
}

请求参数

名称位置类型必选说明
VideosApi-tokenheaderstringnone
bodybodyobjectnone
» appIdbodystring设备ID
» toWxidbodystring好友/群的ID
» emojiMd5bodystringemoji图片的md5
» emojiSizebodyintegeremoji的文件大小

返回示例

200 Response

{
  "ret": 200,
  "msg": "操作成功",
  "data": {
    "toWxid": "***********@chatroom",
    "createTime": null,
    "msgId": 769523643,
    "newMsgId": 891398861855787000,
    "type": null
  }
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» retintegertruenonenone
» msgstringtruenonenone
» dataobjecttruenonenone
»» toWxidstringtruenone接收人的wxid
»» createTimeintegertruenone发送时间
»» msgIdintegertruenone消息ID
»» newMsgIdintegertruenone消息ID
»» typeintegertruenone消息类型

POST 发送appmsg消息

POST /message/postAppMsg

注意

本接口可用于发送所有包含节点的消息,例如:音乐分享、视频号、引用消息等等 引用消息发送需要发送引用消息后观察回调,保存结构。根据回调修改结构的svrid(对应需要引用的newmsgid)和title(需要发送的消息内容),可群内或者聊天内测试。

Body 请求参数

{
  "appId": "{{appid}}",
  "toWxid": "***********@chatroom",
  "appmsg": "<appmsg appid=\"\" sdkver=\"0\">\n\t\t<title>一审宣判!蔡鄂生被判死缓</title>\n\t\t<des />\n\t\t<action />\n\t\t<type>5</type>\n\t\t<showtype>0</showtype>\n\t\t<soundtype>0</soundtype>\n\t\t<mediatagname />\n\t\t<messageext />\n\t\t<messageaction />\n\t\t<content />\n\t\t<contentattr>0</contentattr>\n\t\t<url>http://mp.weixin.qq.com/s?__biz=MjM5MjAxNDM4MA==&amp;mid=2666774093&amp;idx=1&amp;sn=aa405094dd00034d004f6e8287f86e9b&amp;chksm=bcc9d903635a9c284591edda1f027c467245d922d7d66c32d3cd2c6af1c969a7ea0896aa7639&amp;scene=0&amp;xtrack=1#rd</url>\n\t\t<lowurl />\n\t\t<dataurl />\n\t\t<lowdataurl />\n\t\t<appattach>\n\t\t\t<totallen>0</totallen>\n\t\t\t<attachid />\n\t\t\t<emoticonmd5 />\n\t\t\t<fileext />\n\t\t\t<cdnthumburl>3057020100044b304902010002048399cc8402032f57ed02041388e6720204658e922d042462666538346165322d303035382d343262322d616538322d3337306231346630323534360204051408030201000405004c53d900</cdnthumburl>\n\t\t\t<cdnthumbmd5>ea3d5e8d4059cb4db0a3c39c789f2d6f</cdnthumbmd5>\n\t\t\t<cdnthumblength>93065</cdnthumblength>\n\t\t\t<cdnthumbwidth>1080</cdnthumbwidth>\n\t\t\t<cdnthumbheight>459</cdnthumbheight>\n\t\t\t<cdnthumbaeskey>849df42ab37c8cadb324fe94ba46d76e</cdnthumbaeskey>\n\t\t\t<aeskey>849df42ab37c8cadb324fe94ba46d76e</aeskey>\n\t\t\t<encryver>0</encryver>\n\t\t</appattach>\n\t\t<extinfo />\n\t\t<sourceusername>gh_363b924965e9</sourceusername>\n\t\t<sourcedisplayname>人民日报</sourcedisplayname>\n\t\t<thumburl>https://mmbiz.qpic.cn/sz_mmbiz_jpg/xrFYciaHL08DCJtwQefqrH8JcohbOHhTpyCPab8IgDibkTv3Pspicjw8TRHnoic2tmiafBtUHg7ObZznpWocwkCib6Tw/640?wxtype=jpeg&amp;wxfrom=0</thumburl>\n\t\t<md5 />\n\t\t<statextstr />\n\t\t<mmreadershare>\n\t\t\t<itemshowtype>0</itemshowtype>\n\t\t</mmreadershare>\n\t</appmsg>"
}

请求参数

名称位置类型必选说明
VideosApi-tokenheaderstringnone
bodybodyobjectnone
» appIdbodystring设备ID
» toWxidbodystring好友/群的ID
» appmsgbodystring回调消息中的appmsg节点内容

返回示例

200 Response

{
  "ret": 200,
  "msg": "操作成功",
  "data": {
    "toWxid": "***********@chatroom",
    "createTime": 1703842453,
    "msgId": 769523712,
    "newMsgId": 3090682956820882400,
    "type": 0
  }
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» retintegertruenonenone
» msgstringtruenonenone
» dataobjecttruenonenone
»» toWxidstringtruenone接收人的wxid
»» createTimeintegertruenone发送时间
»» msgIdintegertruenone消息ID
»» newMsgIdintegertruenone消息ID
»» typeintegertruenone消息类型

POST 发送小程序消息

POST /message/postMiniApp

Body 请求参数

{
  "appId": "{{appid}}",
  "toWxid": "***********@chatroom",
  "miniAppId": "wx1f9ea355b47256dd",
  "userName": "gh_690acf47ea05@app",
  "title": "最快29分钟 好吃水果送到家",
  "coverImgUrl": "https://che-static.vzhimeng.com/img/2023/10/30/67d55942-e43c-4fdb-8396-506794ddbdbc.jpg",
  "pagePath": "pages/homeDelivery/index.html",
  "displayName": "百果园+"
}

请求参数

名称位置类型必选说明
VideosApi-tokenheaderstringnone
bodybodyobjectnone
» appIdbodystring设备ID
» toWxidbodystring好友/群的ID
» miniAppIdbodystring小程序ID
» displayNamebodystring小程序名称
» pagePathbodystring小程序打开的地址
» coverImgUrlbodystring小程序封面图链接
» titlebodystring小程序标题
» userNamebodystring归属的用户ID

返回示例

200 Response

{
  "ret": 200,
  "msg": "操作成功",
  "data": {
    "toWxid": "***********@chatroom",
    "createTime": 1704162674,
    "msgId": 769533691,
    "newMsgId": 3190424380344821000,
    "type": 33
  }
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» retintegertruenonenone
» msgstringtruenonenone
» dataobjecttruenonenone
»» toWxidstringtruenone接收人的wxid
»» createTimeintegertruenone发送时间
»» msgIdintegertruenone消息ID
»» newMsgIdintegertruenone消息ID
»» typeintegertruenone消息类型

POST 转发文件

POST /message/forwardFile

Body 请求参数

{
  "appId": "{{appid}}",
  "toWxid": "***********@chatroom",
  "xml": "<?xml version=\"1.0\"?>\n<msg>\n\t<appmsg appid=\"\" sdkver=\"0\">\n\t\t<title>info.json</title>\n\t\t<des />\n\t\t<action />\n\t\t<type>6</type>\n\t\t<showtype>0</showtype>\n\t\t<soundtype>0</soundtype>\n\t\t<mediatagname />\n\t\t<messageext />\n\t\t<messageaction />\n\t\t<content />\n\t\t<contentattr>0</contentattr>\n\t\t<url />\n\t\t<lowurl />\n\t\t<dataurl />\n\t\t<lowdataurl />\n\t\t<appattach>\n\t\t\t<totallen>63</totallen>\n\t\t\t<attachid>@cdn_3057020100044b304902010002043904752002032f7d6d02046bb5bade02046593760c042433653765306131612d646138622d346662322d383239362d3964343665623766323061370204051400050201000405004c53d900_f46be643aa0dc009ae5fb63bbc73335d_1</attachid>\n\t\t\t<emoticonmd5 />\n\t\t\t<fileext>json</fileext>\n\t\t\t<cdnattachurl>3057020100044b304902010002043904752002032f7d6d02046bb5bade02046593760c042433653765306131612d646138622d346662322d383239362d3964343665623766323061370204051400050201000405004c53d900</cdnattachurl>\n\t\t\t<aeskey>f46be643aa0dc009ae5fb63bbc73335d</aeskey>\n\t\t\t<encryver>0</encryver>\n\t\t\t<overwrite_newmsgid>594239960546299206</overwrite_newmsgid>\n\t\t\t<fileuploadtoken>v1_0bgfyCkUmoZYYyvXys0cCiJdd2R/pKPdD2TNi9IY6FOt+Tvlhp3ijUoupZHzyB2Lp7xYgdVFaUGL4iu3Pm9/YACCt20egPGpT+DKe+VymOzD7tJfsS8YW7JObTbN8eVoFEetU5HSRWTgS/48VVsPZMoDF6Gz1XJDLN/dWRxvzrbOzVGGNvmY4lpXb0kRwXkSxwL+dO4=</fileuploadtoken>\n\t\t</appattach>\n\t\t<extinfo />\n\t\t<sourceusername />\n\t\t<sourcedisplayname />\n\t\t<thumburl />\n\t\t<md5>d16070253eee7173e467dd7237d76f60</md5>\n\t\t<statextstr />\n\t</appmsg>\n\t<fromusername>zhangchuan2288</fromusername>\n\t<scene>0</scene>\n\t<appinfo>\n\t\t<version>1</version>\n\t\t<appname></appname>\n\t</appinfo>\n\t<commenturl></commenturl>\n</msg>"
}

请求参数

名称位置类型必选说明
VideosApi-tokenheaderstringnone
bodybodyobjectnone
» appIdbodystring设备ID
» toWxidbodystring好友/群的ID
» xmlbodystring文件消息的xml

返回示例

200 Response

{
  "ret": 200,
  "msg": "操作成功",
  "data": {
    "toWxid": "***********@chatroom",
    "createTime": 1704162866,
    "msgId": 769533740,
    "newMsgId": 6455486805605396000,
    "type": 6
  }
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» retintegertruenonenone
» msgstringtruenonenone
» dataobjecttruenonenone
»» toWxidstringtruenone接收人的wxid
»» createTimeintegertruenone发送时间
»» msgIdintegertruenone消息ID
»» newMsgIdintegertruenone消息ID
»» typeintegertruenone消息类型

POST 转发图片

POST /message/forwardImage

注意

若通过发送图片消息获取cdn信息后可替换xml中的aeskey、cdnthumbaeskey、cdnthumburl、cdnmidimgurl、length、md5等参数来进行转发

Body 请求参数

{
  "appId": "{{appid}}",
  "toWxid": "***********@chatroom",
  "xml": "<?xml version=\"1.0\"?>\n<msg>\n\t<img aeskey=\"294774c8ac2ca8f8114e4d58d2ba78a5\" encryver=\"1\" cdnthumbaeskey=\"294774c8ac2ca8f8114e4d58d2ba78a5\" cdnthumburl=\"3057020100044b304902010002043904752002032f7d6d02046bb5bade020465937656042436626431373937632d613430642d346137662d626230352d3832613335353935333130630204051818020201000405004c543d00\" cdnthumblength=\"2253\" cdnthumbheight=\"120\" cdnthumbwidth=\"111\" cdnmidheight=\"0\" cdnmidwidth=\"0\" cdnhdheight=\"0\" cdnhdwidth=\"0\" cdnmidimgurl=\"3057020100044b304902010002043904752002032f7d6d02046bb5bade020465937656042436626431373937632d613430642d346137662d626230352d3832613335353935333130630204051818020201000405004c543d00\" length=\"4061\" md5=\"799ee4beed51720525232aef6a0d2ec4\" />\n\t<platform_signature></platform_signature>\n\t<imgdatahash></imgdatahash>\n</msg>"
}

请求参数

名称位置类型必选说明
VideosApi-tokenheaderstringnone
bodybodyobjectnone
» appIdbodystring设备ID
» toWxidbodystring好友/群的ID
» xmlbodystring文件消息的xml

返回示例

200 Response

{
  "ret": 200,
  "msg": "操作成功",
  "data": {
    "toWxid": "***********@chatroom",
    "createTime": 0,
    "msgId": 769533749,
    "newMsgId": 7003061792458481000,
    "type": null,
    "aesKey": "294774c8ac2ca8f8114e4d58d2ba78a5",
    "fileId": "3057020100044b304902010002043904752002032f7d6d02046bb5bade020465937656042436626431373937632d613430642d346137662d626230352d3832613335353935333130630204051818020201000405004c543d00",
    "length": null,
    "width": null,
    "height": null,
    "md5": null
  }
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» retintegertruenonenone
» msgstringtruenonenone
» dataobjecttruenonenone
»» toWxidstringtruenone接收人的wxid
»» createTimeintegertruenone发送时间
»» msgIdintegertruenone消息ID
»» newMsgIdintegertruenone消息ID
»» typenulltruenone消息类型
»» aesKeystringtruenonecdn相关的aeskey
»» fileIdstringtruenonecdn相关的fileid
»» lengthintegertruenone图片文件大小
»» widthintegertruenone图片宽度
»» heightintegertruenone图片高度
»» md5stringtruenone图片md5

POST 转发视频

POST /message/forwardVideo

注意

若通过发送视频消息获取cdn信息后可替换xml中的aeskey、cdnthumbaeskey、cdnvideourl、cdnthumburl、length等参数来进行转发

Body 请求参数

{
  "appId": "{{appid}}",
  "toWxid": "***********@chatroom",
  "xml": "<?xml version=\"1.0\"?>\n<msg>\n\t<videomsg aeskey=\"5c5163d06757faae44eacc2146ba0575\" cdnvideourl=\"3057020100044b304902010002043904752002032f7d6d02046bb5bade0204659376a6042465623261663836382d336363332d346131332d383037642d3464626162316638303634360204051800040201000405004c56f900\" cdnthumbaeskey=\"5c5163d06757faae44eacc2146ba0575\" cdnthumburl=\"3057020100044b304902010002043904752002032f7d6d02046bb5bade0204659376a6042465623261663836382d336363332d346131332d383037642d3464626162316638303634360204051800040201000405004c56f900\" length=\"490566\" playlength=\"7\" cdnthumblength=\"8192\" cdnthumbwidth=\"135\" cdnthumbheight=\"240\" fromusername=\"zhangchuan2288\" md5=\"8804c121e9db91dd844f7a34035beb88\" newmd5=\"\" isplaceholder=\"0\" rawmd5=\"\" rawlength=\"0\" cdnrawvideourl=\"\" cdnrawvideoaeskey=\"\" overwritenewmsgid=\"0\" originsourcemd5=\"\" isad=\"0\" />\n</msg>"
}

请求参数

名称位置类型必选说明
VideosApi-tokenheaderstringnone
bodybodyobjectnone
» appIdbodystring设备ID
» toWxidbodystring好友/群的ID
» xmlbodystring文件消息的xml

返回示例

200 Response

{
  "ret": 200,
  "msg": "操作成功",
  "data": {
    "toWxid": "***********@chatroom",
    "createTime": null,
    "msgId": 769533762,
    "newMsgId": 2099537549112929300,
    "type": null,
    "aesKey": "5c5163d06757faae44eacc2146ba0575",
    "fileId": null,
    "length": 490566
  }
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» retintegertruenonenone
» msgstringtruenonenone
» dataobjecttruenonenone
»» toWxidstringtruenone接收人的wxid
»» createTimenulltruenone发送时间
»» msgIdintegertruenone消息ID
»» newMsgIdintegertruenone消息ID
»» typenulltruenone消息类型
»» aesKeystringtruenonecdn相关的aeskey
»» fileIdstringtruenonecdn相关的fileid
»» lengthintegertruenone视频文件大小

POST 转发链接

POST /message/forwardUrl

Body 请求参数

{
  "appId": "{{appid}}",
  "toWxid": "***********@chatroom",
  "xml": "<?xml version=\"1.0\"?>\n<msg>\n\t<appmsg appid=\"\" sdkver=\"0\">\n\t\t<title>“李在明遇袭,颈部出血”</title>\n\t\t<des />\n\t\t<action />\n\t\t<type>5</type>\n\t\t<showtype>0</showtype>\n\t\t<soundtype>0</soundtype>\n\t\t<mediatagname />\n\t\t<messageext />\n\t\t<messageaction />\n\t\t<content />\n\t\t<contentattr>0</contentattr>\n\t\t<url>http://mp.weixin.qq.com/s?__biz=MjM5MzI5NTU3MQ==&amp;mid=2652294920&amp;idx=1&amp;sn=ad415f5d83e1471b845b2cb3fca7c3ce&amp;chksm=bce58367ee6ae84b711255705422d1554ee96b92d75648751316639d4aa09289d7827ff1cc85&amp;scene=0&amp;xtrack=1#rd</url>\n\t\t<lowurl />\n\t\t<dataurl />\n\t\t<lowdataurl />\n\t\t<appattach>\n\t\t\t<totallen>0</totallen>\n\t\t\t<attachid />\n\t\t\t<emoticonmd5 />\n\t\t\t<fileext />\n\t\t\t<cdnthumburl>3057020100044b304902010002048399cc8402032f7d6d020468b5bade0204659376ec042463663234636366642d323736612d343533342d623734342d3864623065633235636135390204051808030201000405004c56f900</cdnthumburl>\n\t\t\t<cdnthumbmd5>8e32cafa882f9b4f7c51fb568c0c4f8e</cdnthumbmd5>\n\t\t\t<cdnthumblength>38637</cdnthumblength>\n\t\t\t<cdnthumbwidth>658</cdnthumbwidth>\n\t\t\t<cdnthumbheight>280</cdnthumbheight>\n\t\t\t<cdnthumbaeskey>accc71cbe8ff795a94583fc514d198a8</cdnthumbaeskey>\n\t\t\t<aeskey>accc71cbe8ff795a94583fc514d198a8</aeskey>\n\t\t\t<encryver>0</encryver>\n\t\t</appattach>\n\t\t<extinfo />\n\t\t<sourceusername>gh_d29e0d22a6f9</sourceusername>\n\t\t<sourcedisplayname>澎湃新闻</sourcedisplayname>\n\t\t<thumburl>https://mmbiz.qpic.cn/mmbiz_jpg/yl6JkZAE3SibWvw5icQJpv87X084SRJOVeS3k7KMscRzov1nwicjMYzicyBIpRdJchWKTGPf4eN2H07Jicl11zMK2Pw/640?wxtype=jpeg&amp;wxfrom=0</thumburl>\n\t\t<md5 />\n\t\t<statextstr />\n\t\t<mmreadershare>\n\t\t\t<itemshowtype>0</itemshowtype>\n\t\t</mmreadershare>\n\t</appmsg>\n\t<fromusername>zhangchuan2288</fromusername>\n\t<scene>0</scene>\n\t<appinfo>\n\t\t<version>1</version>\n\t\t<appname></appname>\n\t</appinfo>\n\t<commenturl></commenturl>\n</msg>"
}

请求参数

名称位置类型必选说明
VideosApi-tokenheaderstringnone
bodybodyobjectnone
» appIdbodystring设备ID
» toWxidbodystring好友/群的ID
» xmlbodystring文件消息的xml

返回示例

200 Response

{
  "ret": 200,
  "msg": "操作成功",
  "data": {
    "toWxid": "***********@chatroom",
    "createTime": 1704163083,
    "msgId": 769533781,
    "newMsgId": 1947412320722133800,
    "type": 5
  }
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» retintegertruenonenone
» msgstringtruenonenone
» dataobjecttruenonenone
»» toWxidstringtruenone接收人的wxid
»» createTimeintegertruenone发送时间
»» msgIdintegertruenone消息ID
»» newMsgIdintegertruenone消息ID
»» typeintegertruenone消息类型

POST 转发小程序

POST /message/forwardMiniApp

Body 请求参数

{
  "appId": "{{appid}}",
  "toWxid": "***********@chatroom",
  "xml": "<?xml version=\"1.0\"?>\n<msg>\n\t<appmsg appid=\"\" sdkver=\"0\">\n\t\t<title>👇晒出新年第一杯,点赞赢饮茶月卡</title>\n\t\t<des />\n\t\t<action />\n\t\t<type>33</type>\n\t\t<showtype>0</showtype>\n\t\t<soundtype>0</soundtype>\n\t\t<mediatagname />\n\t\t<messageext />\n\t\t<messageaction />\n\t\t<content />\n\t\t<contentattr>0</contentattr>\n\t\t<url>https://mp.weixin.qq.com/mp/waerrpage?appid=wxafec6f8422cb357b&amp;type=upgrade&amp;upgradetype=3#wechat_redirect</url>\n\t\t<lowurl />\n\t\t<dataurl />\n\t\t<lowdataurl />\n\t\t<appattach>\n\t\t\t<totallen>0</totallen>\n\t\t\t<attachid />\n\t\t\t<emoticonmd5 />\n\t\t\t<fileext />\n\t\t\t<cdnthumburl>3057020100044b30490201000204573515c902032f7d6d020416b7bade020465922a53042437383139393934652d323662652d346430662d396466362d3466303137346139616362390204051408030201000405004c53d900</cdnthumburl>\n\t\t\t<cdnthumbmd5>33cf0a1101e7f8cd3057cd417a691f0b</cdnthumbmd5>\n\t\t\t<cdnthumblength>96673</cdnthumblength>\n\t\t\t<cdnthumbwidth>600</cdnthumbwidth>\n\t\t\t<cdnthumbheight>500</cdnthumbheight>\n\t\t\t<cdnthumbaeskey>6f3098f2ee8b351b6cc9b1818d580356</cdnthumbaeskey>\n\t\t\t<aeskey>6f3098f2ee8b351b6cc9b1818d580356</aeskey>\n\t\t\t<encryver>0</encryver>\n\t\t</appattach>\n\t\t<extinfo />\n\t\t<sourceusername>gh_e9d25e745aae@app</sourceusername>\n\t\t<sourcedisplayname>霸王茶姬</sourcedisplayname>\n\t\t<thumburl />\n\t\t<md5 />\n\t\t<statextstr />\n\t\t<weappinfo>\n\t\t\t<username><![CDATA[gh_e9d25e745aae@app]]></username>\n\t\t\t<appid><![CDATA[wxafec6f8422cb357b]]></appid>\n\t\t\t<type>2</type>\n\t\t\t<version>193</version>\n\t\t\t<weappiconurl><![CDATA[]]></weappiconurl>\n\t\t\t<pagepath><![CDATA[/pages/page/page.html?code=JKD6DA55_3&channelCode=scrm_t664sgg5mrzxkqa]]></pagepath>\n\t\t\t<shareId><![CDATA[0_wxafec6f8422cb357b_25984983017778987@openim_1704162955_0]]></shareId>\n\t\t\t<pkginfo>\n\t\t\t\t<type>0</type>\n\t\t\t\t<md5><![CDATA[]]></md5>\n\t\t\t</pkginfo>\n\t\t\t<appservicetype>0</appservicetype>\n\t\t</weappinfo>\n\t</appmsg>\n\t<fromusername>zhangchuan2288</fromusername>\n\t<scene>0</scene>\n\t<appinfo>\n\t\t<version>1</version>\n\t\t<appname></appname>\n\t</appinfo>\n\t<commenturl></commenturl>\n</msg>",
  "coverImgUrl": "http://dummyimage.com/400x400"
}

请求参数

名称位置类型必选说明
VideosApi-tokenheaderstringnone
bodybodyobjectnone
» appIdbodystring设备ID
» toWxidbodystring好友/群的ID
» xmlbodystring文件消息的xml
» coverImgUrlbodystring小程序封面图链接

返回示例

200 Response

{
  "ret": 200,
  "msg": "操作成功",
  "data": {
    "toWxid": "***********@chatroom",
    "createTime": 1704163145,
    "msgId": 769533801,
    "newMsgId": 5271007655758710000,
    "type": 33
  }
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» retintegertruenonenone
» msgstringtruenonenone
» dataobjecttruenonenone
»» toWxidstringtruenone接收人的wxid
»» createTimeintegertruenone发送时间
»» msgIdintegertruenone消息ID
»» newMsgIdintegertruenone消息ID
»» typeintegertruenone消息类型

POST 撤回消息

POST /message/revokeMsg

Body 请求参数

{
  "appId": "{{appid}}",
  "toWxid": "***********@chatroom",
  "msgId": "769533801",
  "newMsgId": "5271007655758710001",
  "createTime": "1704163145"
}

请求参数

名称位置类型必选说明
VideosApi-tokenheaderstringnone
bodybodyobjectnone
» appIdbodystring设备ID
» toWxidbodystring好友/群的ID
» msgIdbodystring发送类接口返回的msgId
» newMsgIdbodystring发送类接口返回的newMsgId
» createTimebodystring发送类接口返回的createTime

返回示例

200 Response

{
  "ret": 200,
  "msg": "操作成功"
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» retintegertruenonenone
» msgstringtruenonenone

开发API/消息模块/下载

POST 下载文件

POST /message/downloadFile

Body 请求参数

{
  "appId": "{{appid}}",
  "xml": "<?xml version=\"1**********\n</msg>"
}

请求参数

名称位置类型必选说明
VideosApi-tokenheaderstringnone
bodybodyobjectnone
» appIdbodystring设备ID
» xmlbodystring回调消息中的XML

返回示例

200 Response

{
  "ret": 200,
  "msg": "操作成功",
  "data": {
    "fileUrl": "http://videosapi.oos-hbwh.ctyunapi.cn/20250905/wx_Ce9GH6GkpMqsZ8HGWUkQh/21ires=1757642892&Signature=yunPCEDD2Pwx3LLwcHy8vK5dbvE%3D"
  }
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» retintegertruenonenone
» msgstringtruenonenone
» dataobjecttruenonenone
»» fileUrlstringtruenone文件地址,7天有效

POST 下载图片

POST /message/downloadImage

注意 如果下载图片失败,可尝试下载另外两种图片类型,并非所有图片都会有高清、常规图片

Body 请求参数

{
  "appId": "{{appid}}",
  "type": 2,
  "xml": "<?xml version=\"1**********\n</msg>"
}

请求参数

名称位置类型必选说明
VideosApi-tokenheaderstringnone
bodybodyobjectnone
» appIdbodystring设备ID
» xmlbodystring回调消息中的XML
» typebodyinteger下载的图片类型 1:高清图片 2:常规图片 3:缩略图

返回示例

200 Response

{
  "ret": 200,
  "msg": "操作成功",
  "data": {
    "fileUrl": "http://videosapi.oos-hbwh.ctyunapi.cn/20250905/wx_Ce9GH6GkpMqsZ8HGWUkQh/21ires=1757642892&Signature=yunPCEDD2Pwx3LLwcHy8vK5dbvE%3D"
  }
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» retintegertruenonenone
» msgstringtruenonenone
» dataobjecttruenonenone
»» fileUrlstringtruenone图片链接地址,7天有效

POST 下载语音

POST /message/downloadVoice

语音silk格式转换MP3地址:silk转mp3

Body 请求参数

{
  "appId": "{{appid}}",
  "msgId": 5332565812,
  "xml": "<?xml version=\"1**********\n</msg>"
}

请求参数

名称位置类型必选说明
VideosApi-tokenheaderstringnone
bodybodyobjectnone
» appIdbodystring设备ID
» xmlbodystring回调消息中的XML
» msgIdbodynumber回调消息中的msgId

返回示例

200 Response

{
  "ret": 200,
  "msg": "操作成功",
  "data": {
    "fileUrl": "http://videosapi.oos-hbwh.ctyunapi.cn/20250905/wx_Ce9GH6GkpMqsZ8HGWUkQh/21ires=1757642892&Signature=yunPCEDD2Pwx3LLwcHy8vK5dbvE%3D"
  }
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» retintegertruenonenone
» msgstringtruenonenone
» dataobjecttruenonenone
»» fileUrlstringtruenone语音文件链接地址,7天有效

POST 下载视频

POST /message/downloadVideo

Body 请求参数

{
  "appId": "{{appid}}",
  "xml": "<?xml version=\"1**********\n</msg>"
}

请求参数

名称位置类型必选说明
VideosApi-tokenheaderstringnone
bodybodyobjectnone
» appIdbodystring设备ID
» xmlbodystring回调消息中的XML

返回示例

200 Response

{
  "ret": 200,
  "msg": "操作成功",
  "data": {
    "fileUrl": "http://videosapi.oos-hbwh.ctyunapi.cn/20250905/wx_Ce9GH6GkpMqsZ8HGWUkQh/21ires=1757642892&Signature=yunPCEDD2Pwx3LLwcHy8vK5dbvE%3D"
  }
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» retintegertruenonenone
» msgstringtruenonenone
» dataobjecttruenonenone
»» fileUrlstringtruenone视频链接地址,7天有效

POST 下载emoji

POST /message/downloadEmojiMd5

下载emoji时应强制加上下载后缀.png

Body 请求参数

{
  "appId": "{{appid}}",
  "emojiMd5": "sada5996wreFEDE3696sd23r"
}

请求参数

名称位置类型必选说明
VideosApi-tokenheaderstringnone
bodybodyobjectnone
» appIdbodystring设备ID
» emojiMd5bodystringemoji图片的md5

返回示例

200 Response

{
  "ret": 200,
  "msg": "操作成功",
  "data": {
    "Url": "http://videosapi.oos-hbwh.ctyunapi.cn/20250905/wx_Ce9GH6GkpMqsZ8HGWUkQh/21d08948-a109-4efd-ba98-2a297de1e7d0.zip?AWSAccessKeyId=6c1f06ea4941b5a857c0&Expires=1757642892&Signature=yunPCEDD2Pwx3LLwcHy8vK5dbvE%3D"
  }
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» retintegertruenonenone
» msgstringtruenonenone
» dataobjecttruenonenone
»» urlstringtruenoneemoji表情链接地址,7天有效

POST cdn下载

POST /message/downloadCdn

注意 如果是下载图片失败,可尝试下载另外两种图片类型,并非所有图片都会有高清、常规图片

Body 请求参数

{
  "appId": "{{appid}}",
  "aesKey": "plkrjf5968******2ec5r2gcs",
  "totalSize": "63",
  "type": "5",
  "fileId": "5696622*********4569202",
  "suffix": "json"
}

请求参数

名称位置类型必选说明
VideosApi-tokenheaderstringnone
bodybodyobjectnone
» appIdbodystring设备ID
» aesKeybodystringcdn的aeskey
» fileIdbodystringcdn的fileid
» typebodystring下载的文件类型 1:高清图片 2:常规图片 3:缩略图 4:视频 5:文件
» totalSizebodystring文件大小
» suffixbodystring下载类型为文件时,传文件的后缀(例:doc)

返回示例

200 Response

{
  "ret": 200,
  "msg": "操作成功",
  "data": {
    "fileUrl": "http://videosapi.oos-hbwh.ctyunapi.cn/20250905/wx_Ce9GH6GkpMqsZ8HGWUkQh/21d08948-a109-4efd-ba98-2a297de1e7d0.zip?AWSAccessKeyId=6c1f06ea4941b5a857c0&Expires=1757642892&Signature=yunPCEDD2Pwx3LLwcHy8vK5dbvE%3D"
  }
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» retintegertruenonenone
» msgstringtruenonenone
» dataobjecttruenonenone
»» fileUrlstringtruenone文件链接地址,7天有效

数据模型