Bots for Business

A Guide to Building Bots for WeChat

WeChat is one of the world’s most widely used messaging applications. It’s also the single most popular messaging app in mainland China. Explore what’s involved in building WeChat bots, learn about potential development hurdles, see chatbot examples, and learn to build bots that resonate with the WeChat audience.

August 6, 2019
wechat messaging app and tools to build a chatbot

Without consulting a search engine, try to guess the three most popular messaging apps worldwide. If you’re thinking Facebook Messenger, give yourself a point. Two points if you also guessed WhatsApp. For the third one, well, Viber might come to mind. Or maybe Telegram.

Although Viber and Telegram are widely used apps, neither is the third most popular messaging platform. That distinction belongs to WeChat, the primary—and, for all intents and purposes, the only—messaging app used by citizens of China.

The Chinese government exerts tight control over all web-based communications. Unlike in the West, the internet isn’t an open system in China. Only specific applications, websites, and communication platforms are allowed. WeChat is one of them, and it’s a major one. For many people in China, WeChat is more than just a messaging application—it is the internet as they know it.

What does that mean when it comes to building chatbots for WeChat? Let’s explore what’s involved in creating a bot for WeChat and how to connect with users on that platform.

Why build a WeChat bot?

WeChat has more than 1 billion daily active users, practically all of whom are in mainland China. If deploying a bot to the Chinese market is part of your growth plan, WeChat is a place you definitely want to be.

That being said, WeChat users’ expectations for bots aren’t necessarily the same as those of Facebook Messenger or Kik users. As Bot Nerds explains in great detail, there are definitely bots on WeChat. However, as the platform has evolved, they’ve taken a back seat to non-bot apps. Among the bots that exist, you’re unlikely to find complex conversational experiences. Instead of bot-driven communication, the WeChat UX lends itself more to an app-within-app model. Or, as Bot Nerds dubs it, a “super app” model:

WeChat started with bots, but evolved toward a model that (for their users) represents a better user experience. The model they’ve arrived at happens to be more consistent with an app-like experience, rather than chatting with bots. [...] WeChat bots exist, but in a very different context from what we’re accustomed to in the United States.

If you are building a chatbot and want to deploy it to a Chinese audience, you shouldn’t find this information discouraging. Just be aware of your users’ expectations. Given WeChat’s overall structure, users may not anticipate completing a given task via conversation with a chatbot. That being said, there are bots on WeChat, and yours can be one of them.

How to make a WeChat bot

Potential barriers to entry

The first step is understanding what you can and cannot do with WeChat. If you’re operating outside of China, you can’t launch a WeChat app (or a bot, which is technically a type of WeChat app) to the version of WeChat that’s available to Chinese users. In other words, if you operate outside of China, you won’t have access to the Chinese WeChat market.

That being said, if you do work in China or your organization has operations there, you can make a WeChat bot that’s available to Chinese users. You need a Chinese business license and the credentials to create an Official WeChat Account. Be sure you have these before you get started building a bot for WeChat.

Building your WeChat bot

As for actually creating a bot, you can technically use any libraries, API frameworks, and other tools you want. However, you need to use the WeChat sandbox to access the WeChat API. To get your bot onto the platform, the WeChat Official Account system sends a GET request to the URL pointing to your backend server.

However you develop a bot for WeChat, be mindful of the Bot Nerds observation that most human-to-brand experiences on the platform are menu-driven, not conversation-driven. To better align with WeChat user expectations, consider using a menu-style chatbot. Instead of prompting users to enter text, your bot might present them with a list of options to choose from. This is similar to the button-based or “quick reply” model seen in Facebook Messenger.

How to integrate your bot with WeChat

There are different ways to get your bot onto WeChat, but all of them involve having an official account and using the WeChat sandbox. This WeChat tutorial by David Yu explains one of the ways you can integrate a bot with the WeChat messaging app using Node.js and ngrok:

  1. Get a WeChat sandbox account. On the signup page, scan a QR code from the WeChat app. If you don’t read Chinese, get a Chinese-to-English translation plugin. There is no English language option.
  2. Set up your Node.js server and your environment. Add the appropriate appID, and create a token. This information is necessary to finish creating your sandbox account.
  3. Test your server using ngrok. Copy the ngrok URL, and put it in the appropriate field in the WeChat sandbox account setup. Append /wechat to the URL. When prompted, add your appID and token.
  4. Scan the QR code in your sandbox account dashboard. That’s right, there’s another QR code. This one completes the setup process. After scanning it, WeChat verifies that the token matches the one from your server.

With these steps, you tell WeChat to publish a bot, hosted on your local server, via ngrok. Although your bot will likely be hosted elsewhere and you might be using different tools, the mechanics of the process are similar.

When you integrate your bot with WeChat, be sure to integrate it with your own website at the same time. By deploying your bot to a dedicated domain, such as a .BOT domain, many users can access it even if they aren’t logged in to WeChat. Doing so also gives users outside of mainland China the opportunity to communicate with your bot.

WeChat chatbot examples

Travel chatbots

Many Chinese travelers use WeChat to stay connected with family and friends while traveling abroad. The VISA TravelBot helps in this regard. After following the #MeetTheLocal official account, users can activate the VISA chatbot, which serves as a local guide to a given travel destination.

By chatting with the VISA TravelBot, users can find reviews of establishments, maps, and pictures of places they might visit. And yes, the bot alerts them to specific deals from VISA.

The VISA TravelBot is an excellent example of how you might use chatbots on WeChat within the context of an app. #MeetTheLocal is an app within WeChat, and the bot is only a part of it. The bot, therefore, isn’t the sum total of the application. Rather, it’s part of the overall experience.

Entertainment chatbots

For a more traditional chatbot experience (typical of many bots on WeChat, according to Bot Nerds), users can activate Xiaolce, which is a social chatbot that can converse about a variety of topics. Xiaolce submits her “opinions” on various subjects and even discusses celebrity gossip with you.

Shopping chatbots

One example of a simple (but useful) WeChat bot is Meici bot. Meici is a popular flash sale website in China. WeChat users can activate the Meici bot to receive updates about deals on apparel and fashion accessories. They can get advice about which clothing to purchase based on information they feed to the bot.

This chatbot’s design is that of a typical WeChat bot. Users enter simple queries (for example, help me find clothing), and the bot sends them down a predefined conversation flow. In the case of the Meici bot, that would involve getting a few necessary details about the user, such as whether they’re male or female, and then providing a list of items they can purchase through Meici.

Getting started with WeChat bots

Determine whether you meet the prerequisites to reach a Chinese audience on WeChat. Do you already operate in China? Can you get a Chinese business license? If so—and if you’re keen to deploy a bot that interacts with users in mainland China—go for it!

The WeChat documentation is extensive and describes all of your options for developing WeChat applications, bot-based or otherwise. Read the Getting Started Guide to get a handle on the basics of getting your bot onto the platform. The Official Accounts section offers detailed information about the requirements you need to meet.

Lastly, be sure to work with native Chinese speakers. Even if you manage to navigate WeChat itself using translation tools, that chatbot dialogue isn’t going to write itself! Somehow or another, you’ll want to have one foot (or both feet) in China as you develop your WeChat bot.