What’s it like to build a Mini-Program for WeChat Work?

Lessons from prototyping in WeChat Work

David Yu
David Yu
Jul 23, 2019 · 4 min read
Image for post
Image for post

Is it worth it? I heard big companies are using it.

This WeChat Work thing.

As if there’s not enough mystery around WeChat Work, people want to know what’s the benefit of having a Mini-Program bound to WeChat Work.

In this article, we will explore the possibilities of Mini-Program with WeChat Work from a developer’s perspective.

UserID is OpenID

As Open ID is unique to a user under an Official Account, a User ID is unique to a user under WeChat Work platform.

Mini-Program needs to be published to be bound to WeChat Work Account

Before you can see how you can interact with your Mini-Program in WeChat Work, you will need to have a published Mini-Program.

You could scan the QR code of your beta version with your WeChat Work app, but some functionalities will not work until you bind the Mini-Program.

WeChat Work Plugin in DevTool

Image for post
Image for post
Find the plugin option under Tool tab
Image for post
Image for post
Switch to 企业微信 mode

Source: https://developers.weixin.qq.com/miniprogram/dev/devtools/qywx-dev.html

Similar to the limitation mentioned above, some functionalities are limited to a physical device.

Internal and External Contact

  • Since you can add normal WeChat user through WeChat Work app, the users are divided into internal and external contacts

To find the API secret and the place to set up your callback when a new user is added to WeChat Work account, it’s hidden within the API button under the “Customer Contact” tab.

Image for post
Image for post

Similar to how you set up WeChat Chatbot for Official Account, you would set up an endpoint to receive events. Official Doc.

  • One of the biggest advantages of WeChat Work for the organization is that they will have access to sale representatives’ contact even if they quit.
Image for post
Image for post
  • Not every employee will have access to external contact by default.
Image for post
Image for post
You will need to set it up in here

Jump in and out of Conversation

Image for post
Image for post
  • You will be able to set the different pages that employee could open from the attachment
  • You can get the userID of the conversation if the Mini-Program is opened from here, using the method below
wx.qy.getCurExternalContact({
success: function(res) {
var userId = res.userId
}
});

Multiple API Secret and Token

If you play around in the WeChat Work admin panel, you will realize there are multiple API secrets for different kinds of services.

  • For a syncing contact list
  • For your Mini-program
  • For your callback URL
  • And more if you bind more Mini-Programs

Make sure you have the right user role, so you can see the full picture in the admin panel.

Conclusion

If your organization already adopted WeChat Work, by all means, take advantage of the API and functionalities provided.

However, in my opinion, WeChat Work is great for internal communication and might be the answer to free Chinese workers from 996 work culture.

It’s average for handling customer relationships because it actually alienates the sale representative as someone who only talks on the organization’s behalf. Instead of the normal WeChat relationship where sale representative could even potentially be viewed as a friend.

If you want to learn more about WeChat related software development, click here for a free glossary.

Shanghai Coders

Sharing software development required in China

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store