Getting started with a WeChat Channel
WeChat channel enables communication with users of the WeChat ecosystem through the Conversation API.
Prerequisites
Before you can set up a WeChat channel on the Conversation API, you need to do the following:
General requirements
Note
If you have already completed the Conversation API Getting started steps, you can skip this section.
- Sign up for the Sinch Customer Dashboard.
- Get access to the Conversation API.
- Create your app.
- Create your access key. Any API calls you make will require authentication information provided by your access key.
Refer to the Conversation API Getting started section for more information on any of these steps.
WeChat requirements
There are a few types of WeChat accounts, including Work Accounts, Verified/Unverified Subscription Accounts, and Verified/Unverified Service Accounts. Only Verified Service Accounts have full API access, so you need a WeChat Verified Service Account to integrate your Conversation API app with WeChat.
To get your Service Account verified by an authorized agency, the account owner must have a legal business entity in China. A Verified Service Account indicates verification status in the Type and Verification fields on the WeChat Official Accounts Platform:Configuring the Conversation API and WeChat integration
Next, you must enable the WeChat integration for your Conversation API app.
Enabling the WeChat integration using the Sinch Customer Dashboard
The easiest way to configure your Conversation API app with WeChat support is to use the Sinch Customer Dashboard. For a full description of how to connect your WeChat account to your Conversation API app, see the Community article How do I configure a WeChat channel on the Conversation API?. A summary of the process is provided below:- Log in to the Sinch Customer Dashboard and navigate to your Conversation API app.
- Select WeChat in the Set up channels section.
- Open your WeChat Official Accounts Platform admin portal and navigate to the Basic configuration page. Copy the Developer ID and Developer Password and paste them into the appropriate fields in the Sinch Customer Dashboard.
- Click Change Configuration on the WeChat Official Accounts Platform. Copy the Token and EncodingAESKey and paste them into the appropriate fields on the Sinch Customer Dashboard.
Note
You may have to create or generate your own Token and EncodingAESKey. - Click Save on the Sinch Customer Dashboard. Copy the Callbak URL from the Sinch Customer Dashboard and paste it into the URL field of your WeChat Official Accounts Platform.
Note
You must have at least one Conversation API webhook to trigger POST callbacks to the given URL. For more information on how to create a webhook using the Customer Dashboard, see How to add a webook to a Conversation API app. - Ensure that the Message Encryption Method is set to Security Mode on your WeChat Official Accounts Platform.
- Click Submit on your WeChat Official Accounts Platform.
Enabling the WeChat integration using the Conversation API
If you decide to configure your app through API calls, follow these steps:
- Update your Conversation API app with WeChat channel credentials as
given in the example snippet below:You need to replace
{ "channel_credentials": [ { "channel": "WECHAT", "wechat_credentials": { "app_id": "{{WECHAT_APPID}}", "app_secret": "{{WECHAT_APPSECRET}}", "token": "{{WECHAT_TOKEN}}", "aes_key": "{{WECHAT_AESKEY}}" } } ] }
{{WECHAT_APPID}}
,{{WECHAT_APPSECRET}}
,{{WECHAT_TOKEN}}
and{{WECHAT_AESKEY}}
with the values from you WeChat Official Accounts Platform. - Set the callback URL for your WeChat channel to the URL of the Conversation API displayed in WeChat Official Accounts Platform. The format of callback URL is:Where
https://wechat-adapter.{{REGION}}.conversation-api.prod.sinch.com/adapter/v1/{{CONVERSATION_APP_ID}}/callback
{{REGION}}
is eithereu1
orus1
, depending on the region of your app. Replace{{CONVERSATION_APP_ID}}
with the ID of your Conversation API app.Note
For information on how to add a Conversation API webhook programmatically, click here.
Next steps
After configuring the channel, you need to set the channel priority in your app.If you already know how to set channel priority, or your channel priority is already established, you can begin sending and receiving messages in your preferred language: