WeChat as an inbound channel
WeChat is a text and voice messenger that also supports video and voice VoIP calls.
Do the following to use WeChat as an inbound channel:
Creating a test account
You will need to register a WeChat account and install the official app on your smartphone to create a bot.
We will connect an app-based bot for a test account in the WeChat interface. You might want to install a plugin or switch your language, as the website is only available in Chinese.
- Click Authorize, and the page with a QR code will appear.
- Open the WeChat mobile app and click → Scan QR code.
- Scan the QR code from the web page and click Agree in the window that appears. You will get administrative access to the test account.
- Copy the following values:
WeChat ID
,appID
andappsecret
. You will need them to create a channel.
- In the URL field, enter the server address to which WeChat will send us requests. The server address should be the following way:
https://{host_name}/chatadapter/chatapi/webhook/{channel_name}/{WeChat_ID}
In the Token field, you need to enter
WeChat ID
to generate a signature. This field must match theWeChat_ID
specified in the server URL to pass the security check.Click Submit and proceed to create a channel.
Creating a channel
Click Channels → Inbound → Connect channel on the control panel. Select WeChat under Messengers and social networks.
Fill out the following fields:
- Name — specify a name for the channel or keep the default one.
- Access token — specify your bot’s WeChat ID generated when you created your test account.
- AppID — specify the application ID generated when you created your test account.
- Appsecret — specify the application access token generated when you created your test account.
- Branch — specify the project branch you want to deploy into the channel (
master
by default). You can also select a Git tag or enter a specific commit hash. - Deployment — select Automatic (whenever any change made to the project is saved) or Manual (using the Deploy button in the channel description line).
Click Create. Wait for a pop-up window with the deploy result to appear.
Testing a bot
To open a dialog window with a bot in WeChat:
- Open the WeChat mobile app and click → Scan QR code.
- Go to the test account web page, find the QR code, and scan it using the app.
- A test account will appear in the app. Click Follow. The dialog window will be opened automatically.
- Send a greeting/activation phrase according to your script. Then a dialog with your bot should start.