WeChat channel testing and channel management
The following section provides information on testing and managing the WeChat channel of your Conversation API app.
Testing the integration
The WeChat Admin Portal prepares a few QR codes for your channel, and you can use the QR code to promote your channel.
To test your integration, open the WeChat app, scan the QR code, and click Follow
to subscribe to the channel.
You will get two callbacks on your Conversation API webhooks. Examples of these callbacks are below (IDs and identities
are masked):
One is the opt_in_notification
:
{
"app_id": "01FM9JB4SAC2FW7FG88ABCDEFG",
"accepted_time": "2021-11-12T08:02:26.428685Z",
"event_time": "2021-11-12T08:02:25.384Z",
"project_id": "60d53e51-21f2-abcd-1234-a2d127f480c0",
"opt_in_notification": {
"contact_id": "01FM9JPMVY8ZDXP8MN4ABCDEFG",
"channel": "WECHAT",
"identity": "oA4ha12Pp-abcDeFgHiJ12-LHrdg",
"status": "OPT_IN_SUCCEEDED",
"request_id": "01FM9JPMZW2GGE2MPN7DABCDEF"
},
"message_metadata": ""
}
The other is the Contact creation notification:
{
"app_id": "",
"accepted_time": "2021-11-12T08:02:26.366075Z",
"project_id": "60d53e51-21f2-abcd-1234-a2d127f480c0",
"contact_create_notification": {
"contact": {
"id": "01FM9JPMVY8ZDXP8MN4ABCDEFG",
"channel_identities": [
{
"channel": "WECHAT",
"identity": "oA4ha12Pp-abcDeFgHiJ12-LHrdg",
"app_id": "01FM9JB4SAC2FW7FG88ABCDEFG"
}
],
"channel_priority": [
"WECHAT"
],
"display_name": "",
"email": "",
"external_id": "",
"metadata": "",
"language": "UNSPECIFIED"
}
},
"message_metadata": ""
}
Both callbacks contain the field contact_id
, which is the identifier of the contact that was automatically created
when processing the inbound WeChat message. This contact contains the channel identity for the WeChat user, and you can
use this contact_id
to reach that WeChat user.
The WeChat channel identities are identifiers which are scoped to individual apps. This means that the same WeChat user will have different channel identities for two different Conversation API apps.