Skip to content

WeChat Official Account

test

A WeChat Official Account exists in the form of a Wechat user's contact and chat is the basis for the interaction between the Official Account and its users.

We are going to show here how to integrate OpenCUI with WeChat and deploy the chatbot to a OpenCUI hosted environment. For the private deployment, please consult systems in your organization.

Follow these steps to configure:

Before you begin

If you don't have WeChat Official Account, set up one first.

  1. Go to WeChat Official Account Platform, click Register Now
  2. Select Service Account or Subscription Account, and follow the instructions that are provided on the screen to complete the process.

register

Set up WeChat Official Account

  1. Go to WeChat Official Account Platform and log in with your WeChat Official Account.
  2. In the Setting and Development field, click Basic configuration.
  3. In the Official Account development information field, 📋 copy Developer ID(AppID) and Developer Password(AppSecret)

set up wechat official account

Notice

If you used Developer Password(AppSecret) before but didn't store it, you can click Reset to get a new one.

  1. Click Configuration (or View), add 123.56.222.81 to IP whitelist and click Confirm modification to save the modification.

config whitelist

Configure WeChat from OpenCUI

  1. On OpenCUI platform, go to service component io.opencui.channel:

    1. Click Import button on the second topbar.
    2. Select the chatbot you want to configure WeChat channel and Save.

    import channel component

  2. Once you have done, switch to your chatbot to wire WeChat channel:

    1. On STRUCT level, head to Settings page, in the Integrations tab, select the service you just import. In this case, please select io.opencui.channel.IChannel.
    2. A configuration dialog opens, at Service Provider field, select io.opencui.wechatOfficialAccount to wiring WeChat channel.

    select the serviceSelect service io.opencui.channel.IChannel

    select a channelWire WeChat channel

  3. Continue inside the dialog, configure WeChat integration as following:

    • Label: Enter channel label, should be unique.
    • App ID: Paste the developer ID you copied during the WeChat Official Account setup above.
    • App Secret: Paste the developer password you copied during the WeChat Official Account setup above.
    • Token: Enter any token you desire. 📋 Copy this value. This will be used to configure the WhatsApp Webhook.
    • Payment: Whether to use WeChat Pay.
    • Locale: Select locale which determines the default language used by your bot.
    • Callback URL: 📋 Copy this value after setting the label and locale. This will be used to configure the WeChat Server Configuration.

    add channel

  4. Before you go to next step, don't forget to merge your changes into master and deploy your chatbot.

Finish WeChat Official Account setup

  1. Back to WeChat Official Account Platform, In the Server Configuration (服务器配置) field, click Change Configuration. Paste Callback URL and Token you copied.

config server

  1. Click Random Generation to generate EncodingAESKey and click Submit.

generate key

Test your chatbot

Once you deploy successfully, you can try to send messages to your WeChat Official Account to test your chatbot now. If you get a response, you have fully set up your app for receiving messages! 🎉