Updated on 2025-11-13 GMT+08:00

Receiving and Processing MO Messages Sent on WeChat

Function

This interface is invoked to receive and process MO messages sent on WeChat.

Prerequisites

The interface in WeChat Channel Interface Authentication has been successfully invoked and authentication information has been generated.

Interface Prototype

Table 1 Interface prototype description

Method

POST

URL

https://{IP address}:{Port number}/social/on/wechat/{channelId}

{IP address}:{Port number} indicates the IP address and port number of the NSLB exposed externally.

{channelId} indicates the channel ID.

https://{IP address}:{Port number}/social/with/wechat/msg/{appID}

{IP address}:{Port number} indicates the IP address and port number of the NSLB exposed externally.

{appID} indicates the WeChat developer ID.

Request Parameters

Table 2 Request header parameter

Parameter

Mandatory or Not

Type

Description

Content-Type

Yes

String

The value is fixed at application/json; charset=UTF-8.

Table 3 Request body parameter

Mandatory or Not

Type

Description

Yes

XML

The XML file contains the message type, msgId, toUserName, fromUserName, time, and content.

Response Parameters

If this interface is invoked successfully, no response is returned.

If this interface fails to be invoked, the corresponding status code and error description are returned.

Example

The input and output parameters of https://{IP address}:{Port number}/social/on/wechat/{channelId} and https://{IP address}:{Port number}/social/with/wechat/msg/{appID} interfaces are the same. The following uses the https://{IP address}:{Port number}/social/on/wechat/{channelId} interface as an example.

  • Request
    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>
  • Response
    Status Code: 500
    response: "WeChatMessaging send failed"