JAICP

WeChat


WeChat is a popular messenger that supports text and voice messages in private and group chats, as well as sending different media types.

You can use WeChat as a publication channel for your Aimylogic bot.

Connect the channel

After you've prepared and tested the script, you can publish it in the WeChat channel. To do this, a few steps are required:

  • Connect a test account
  • Create a channel
  • Test the bot

Connect a test account

To use the test account, you're going to need the https://mp.weixin.qq.com/ web app. Since it only exists in Chinese, we recommend using a plugin translator for your browser.

After logging in, you'll see a page with a QR code you have to scan.

  • Go to your WeChat mobile app, press + > Scan QR code
  • Scan the QR code from the web page and click Agree in the window that appears. You will get admin access to the test account
  • Copy the following values. You will need them to create a channel:
    • WeChat ID (upper right corner)
    • appID (pre-filled in)
    • appsecret (pre-filled in)

wechat 2

In the URL field, enter the server address to which WeChat will send us requests. The server address should look as follows: https://{имя_хоста}/chatadapter/chatapi/webhook/{название_канала}/{WeChat_ID}

Into the Token field, paste the WeChat ID to generate a signature. This field must match the WeChat_ID specified in the server URL to pass the security check.

Click Submit and proceed to create a channel.

Create a channel

Go to your Aimylogic account and open the script you want to publish in the WeChat channel.

Go to Channels settings of the bot and pick WeChat from the section Messengers, social media, and API

Using the data from the test account, fill in the fields:

  • TokenWeChat ID of your bot from the test account
  • AppIDappID from the test account
  • AppSecretappsecret from the test account

Click Publish.

Test the bot

To test the bot:

  • Go to the WeChat mobile app and press + > Scan QR code
  • On the admin page of the test account find the QR code and scan it using the app
  • The test account will appear in the app. Click Follow. The dialog window will open automatically
  • Send the greeting/activation phrase you've set in your script. The dialog 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