This node.js example connector allows you to make your Teneo bot available on WeChat. The connector acts as middleware that establishes a conversation between WeChat and Teneo. This guide will take you through the steps of setting up this WeChat connector.
You can find the source code for this connector on Github.
WeChat's website is in mandarin. The instructions below should be able to get you going even if you don't understand Mandarin. If desired however, you may wish to use an extension to translate their website.
Making the connector available via https is preferred. We recommend using ngrok for this.
WeChat app should already be running on your device. If not, download it from an App Store and Sign up for a new account.
Your bot needs to be published and you need to know the engine URL.
- Download or clone the connector source code:
git clone https://github.com/artificialsolutions/tie-api-example-wechat.git
- Install dependencies by running the following command in the folder where you stored the source:
- Login to the WebChat Dashboard by clicking the green login button on this page: https://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=sandbox/login
- A QR code will appear. In the Wechat app, go to the Discover tab and choose 'Scan'. Scan the QR code with the Wechat app, and a sandbox configuration dashboard will be displayed.
- Choose your own value for the
Tokenfield and copy or remember it, you will need it later.
- Next copy the
appIDthat is shown in the first row of the first table at the top of the page.
- Create a file called
.envin the root folder of the project. Give it the following content:
APP_ID=<your app id here> TOKEN=<your token here> TENEO_ENGINE_URL=<your teneo engine url here>Replace the placeholders with the values you copied earlier.
- Start the connector with the following command (replacing the environment variable with the appropriate value):
Use ngrok the connector available via https:
- Make sure your connector is available via https. When running locally you can for example use ngrok for this. Run the connector on port 3000 by default.
ngrok http 3000
- Running the command above will display a public https URL, copy it, we will use it as a
URLvalue for the following steps.
- Once the connector is available via https, copy the
URLfrom the previous step into the URL of Webchat's dashboard online. Also, add a
- Tap the green Submit button to save all settings.
- Open WeChat, and tap "Scan" from the 'Discover' tab menu.
- Scan the QR code that appears halfway down the Webchat Dashboard.
- A new chat will appear. You are now ready to chat with your Teneo chatbot.