WeChat as an incoming channel
WeChat is a text and voice messenger that also supports video and voice VoIP calls.
Do the following to use WeChat as an incoming channel:
Creating a test account
Please note that WeChat only allows one bot to be connected to one test account at a time. To connect other bots, create a new test account for each bot.
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 > Incoming > Create 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 to the channel (
master
by default). - Deploy — Select Automatic (each time any change made to the project is saved) or Manual (using the Publish button in the channel description line).
Please note the Deploy radio button. You have to deploy a script before starting the chat bot. At this stage, the system builds the chat bot, checks script syntax and performs tests.
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 dialogue with your bot should start.
To open the bot chat in the app, go to Contacts > Official accounts and find your test account chat in the list.