接收并处理微信发送的上行消息接口
接口功能
接收并处理微信发送的上行消息接口。
前提条件
成功调用微信认证接口,生成鉴权信息。
接口原型
|
请求方法 |
POST |
|
|---|---|---|
|
请求URL |
https://ip:port/social/on/wechat/{channelId} |
其中,ip:port为对外暴露的nslb的ip和port, channelId为渠道id |
|
https://ip:port/social/with/wechat/msg/{appID} |
其中,ip:port为对外暴露的nslb的ip和port, appID为微信开发者ID。 |
|
请求参数
|
参数名称 |
选取原则 |
参数类型 |
说明 |
|---|---|---|---|
|
Content-Type |
必选 |
String |
固定填 application/json; charset=UTF-8。 |
|
选取原则 |
参数类型 |
说明 |
|---|---|---|
|
必选 |
XML |
xml包含消息类型、msgId、toUserName、fromUserName、time、content |
响应参数
当调用本接口响应成功,response 无响应内容。
当调用本接口响应失败,则返回相应的状态码或者错误描述信息。
接口示例
https://ip:port/social/on/wechat/{channelId} 和https://ip:port/social/with/wechat/msg/{appID}的出入参完全一样,以下以https://ip:port/social/on/wechat/{channelId} 接口为例介绍。
- 请求示例
POST /social/on/wechat/202105112580330807 <xml><ToUserName><![CDATA[gh_8fad0a222d9b]]></ToUserName><FromUserName><![CDATA[olOKd6t2BIXSi4I33LDqrRcVnyxg]]></FromUserName><CreateTime>1629166939</CreateTime><MsgType><![CDATA[text]]></MsgType><Content><![CDATA[。。。]]></Content><MsgId>23324061692833458</MsgId></xml>
- 响应示例
Status Code: 500 response: "WeChatMessaging send failed"