DEV Community

David Yu
David Yu

Posted on • Originally published at Medium on

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

Lessons from prototyping in WeChat Work

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

Find the plugin option under Tool tab

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.

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.

  • Not every employee will have access to external contact by default.

You will need to set it up in here

Jump in and out of Conversation

  • 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.


Top comments (1)

Collapse
 
sneakysneakr profile image
SneakySneaker

Hi David,

Great article, only just discovered the benefits of WeChat.

I have a question for you:

I was looking to create a mini-program for my store. However my plan was to use the mini-program to direct consumers to my store by the use of a hyperling, my mini-program would only be one page. My online store is a shopify site which accepts Alipay and Wepay would a mini-program allow me to do this.