What’s it like to build a Mini-Program for WeChat Work?
Tags: softwaredevelopment, business, wechat, china
Published: 2019-09-27 03:29:02

---
title: What’s it like to build a Mini-Program for WeChat Work?
published: true
tags: software-development,business,wechat,china
canonical_url: 
---

#### Lessons from prototyping in WeChat Work

![](https://cdn-images-1.medium.com/max/1024/1*Bcsu1JZ8ibo9I7sc6KNkFw.png)

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

![](https://cdn-images-1.medium.com/max/1024/1*M4pF-1srmD_LcxZ5IjdewA.png)<figcaption>Find the plugin option under Tool tab</figcaption>

![](https://cdn-images-1.medium.com/max/976/1*5vLh-rST1KanWs0gzwg7mg.png)<figcaption>Switch to 企业微信 mode</figcaption>

Source: [https://developers.weixin.qq.com/miniprogram/dev/devtools/qywx-dev.html](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.

![](https://cdn-images-1.medium.com/max/1024/1*Wo_1Zen1BYINmqgOUdEkYA.png)

Similar to how you set up [WeChat Chatbot](https://medium.com/china-software-development/build-your-wechat-chatbot-6e439d3c9650?source=your_stories_page---------------------------) for Official Account, you would set up an endpoint to receive events. [Official Doc](https://work.weixin.qq.com/api/doc#90000/90135/90930).

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

![](https://cdn-images-1.medium.com/max/606/1*9HeyyKeOtvKK2_SnrWs4fw.png)

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

![](https://cdn-images-1.medium.com/max/676/1*i7zNKspIn1ULaWEnrcYP4w.png)<figcaption>You will need to set it up in here</figcaption>

### Jump in and out of Conversation

![](https://cdn-images-1.medium.com/max/1024/1*OjV_iA99SGX1AAZ2RsJEYA.jpeg)

- 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](https://pages.convertkit.com/b2469604dd/0c671fdd2d).

* * *