How to add a WeChat Bot to the Chat API

Getting started with WeChat is easy! Follow these steps to be up and running in no time! To use WeChat with Chat API you will need an Official Account or a Sandbox (testing) account.
Using a Sandbox Account is very easy and will be explained below.
Using an Official Account is a bit more work and can be done here: http://apply.wechat.com/. If you just want to test WeChat we recommend using the Sandbox version. We also offer help when going for the Official Account version.

 

Sandbox Account version

  1. First off, go to http://admin.wechat.com/debug/cgi-bin/sandbox?t=sandbox/login and press the green ‘Log In’ button.

  2. Scan the QR code you see to Log In with your WeChat account. This will direct you to a the Sandbox dashboard.

  3. On the Sandbox Dashboard you should see 3 values already available: WeChat ID, appID and appSecret. Write these 3 values down as you’ll need them in the next step.

  4. Go back to the MessageBird Dashboard, choose a name for the channel and fill in the WeChat ID (also called Open ID), appID and App Secret you received during Step 3.

  5. At the Token field you can fill in a random string like ‘xYYyczjJb5LrWyyzg24jM7GU’. Please write this Token down.

  6. After doing this you can click on ‘Add’ to add the Channel to your account.

  7. The next step is to go back to the WeChat Sandbox and scroll down to the ‘API Config’ section. Here you have to fill in 2 values: URL and Token.
         a. The URL is https://chat.messagebird.com/wechat/webhook/<WeChatID> where you have to fill in the WeChat ID (or Open ID) you wrote down at Step 3.
         b. The Token is the random string of numbers/letters you chose at Step 5.

  8. After filling in these values you can click on the green ‘Submit’ button to finalize the connection. You may have to click a few times before you get a green message saying the connection is valid.


Done! You have just created a WeChat Sandbox account and connected it to the Chat API. If you scroll down to ‘Test account QR Code’ in the Sandbox Dashboard you will find a QR that users can scan to connect with your Sandbox Channel.

 

Official Account version

If you are interested in getting an Official Account or already have one available, send us a mail at product@messagebird.com.  We will happily help you connect your Official Account to the Chat API.