How to send a message to your user’s WeChat?

Until they change their API again

David Yu
Shanghai Coders
4 min readOct 23, 2019

--

Photo by Kate Macate on Unsplash

Since WeChat is the primary messaging app in China with 45 billion messages sent per day, how can your organization take advantage of these interactivities?

It sounds like something easy to do. Yet, if you look at their official document,

Do you feel more confused? And that’s just the Official Account documentation.

So the purpose of this article is to list out all of the different ways you can send a message, explain its purpose, and hopefully gives you more confidence in implementing your new feature with WeChat.

Official Doc: https://developers.weixin.qq.com/doc/offiaccount/en/Message_Management/Receiving_standard_messages.html

Auto Reply

What is this?

When you connect your server to your Official Account’s webhook, you can send a message once you receive a message or an event from the user.

An event can be one of the following

  1. Following / Unfollowing Events
  2. QR Code with Parameters Scan Event
  3. Location Reporting Events
  4. Custom-Defined Menu Events
  5. Menu Tap Message Pull Event Pushes
  6. Menu Tap Go To Link Event Pushes

Purpose

Immediate response to user’s action on behave of your Official Account

The most common use case is a chatbot, user data collection, restaurant order system.

For how to implement a chatbot for WeChat check out these articles:

Service Center Message(Delayed Auto Reply)

What is this?

A way to send a message as a customer service representative within 48 hours after a user’s action.

Action includes:

  1. The user sends a message.
  2. Clicking on a custom-defined menu (only three menu options, that is, a tap event push, scan event push, and a QR code scan push with a ‘Receiving message’ prompt will trigger the Service Center API)
  3. Following an Official Account.
  4. Scanning a QR code.
  5. Making a successful payment.
  6. Protecting User’s Rights

Purpose

Customer service messages.

Content Message

What is this?

Send your WeChat article, images, audio, or video to a targeted audience.

If you worked with WeChat Official Account before, you might have worked with their CMS to create content. This is almost the same thing through API, but the limitation still applies.

Subscription Account:

One message per day

Service Account:

Four message per month

Purpose

Allows for automated content distribution

Template Message

What is this?

Pre-defined template for important notification.

Purpose

Important notification such as payment confirmation, shipment notification, etc.

Be sure to look at the official for its rules, if you abuse this API, your account could be banned.

One Permission One Message

What is this?

Send a message to a user with a user’s explicit permission.

You can also obtain a user’s permission through WeChat’s mobile SDK.

Purpose

To offer the user more autonomy to opt-in for message.

For developers, it just means more work, but it’s very likely that WeChat will lean into this direction for future messaging.

Also if your use case isn’t covered by template message or service center message, this can be your option as well.

Side Note

Certain categories can send multiple messages after permission:

Governmental, Medical, Transportation, Finance, Education.

Source: https://developers.weixin.qq.com/community/develop/doc/00008a8a7d8310b6bf4975b635a401?blockType=1

What about WeChat Mini-Program?

In the past, I wrote an article about how to send a template message for WeChat Mini-Program.

However, WeChat will deprecate this method on January 10th, 2020.

You will have to use the one permission one message method in the future.

Official Doc(Note that the English version is incomplete): https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/subscribe-message.html

Because Mini-Program message is more or less the same as Official Account, I will just summarize them:

  1. One time subscription message(one permission one message)

2. Service Message(message within 48hours of interaction)

3. Uniform Message — Send template message on behave of Mini-Program and Official Account at the same time

Conclusion

WeChat is always a mysterious world for software development. For more learning material, please visit: https://shanghaicoders.com/blog

--

--

David Yu
Shanghai Coders

Full-stack developer based in Shanghai. I help people turning their ideas into reality.