<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: David Yu</title>
    <description>The latest articles on DEV Community by David Yu (@davidyu37).</description>
    <link>https://dev.to/davidyu37</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F226837%2F31bfbb2d-68b8-4bbd-9bba-3ec7ca638048.jpeg</url>
      <title>DEV Community: David Yu</title>
      <link>https://dev.to/davidyu37</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/davidyu37"/>
    <language>en</language>
    <item>
      <title>What’s it like to build a Mini-Program for WeChat Work?</title>
      <dc:creator>David Yu</dc:creator>
      <pubDate>Tue, 23 Jul 2019 10:03:58 +0000</pubDate>
      <link>https://dev.to/davidyu37/what-s-it-like-to-build-a-mini-program-for-wechat-work-1k10</link>
      <guid>https://dev.to/davidyu37/what-s-it-like-to-build-a-mini-program-for-wechat-work-1k10</guid>
      <description>&lt;h4&gt;
  
  
  Lessons from prototyping in WeChat Work
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2ABcsu1JZ8ibo9I7sc6KNkFw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2ABcsu1JZ8ibo9I7sc6KNkFw.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Is it worth it? I heard big companies are using it.&lt;/p&gt;

&lt;p&gt;This WeChat Work thing.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;In this article, we will explore the possibilities of Mini-Program with WeChat Work from a developer’s perspective.&lt;/p&gt;

&lt;h3&gt;
  
  
  UserID is OpenID
&lt;/h3&gt;

&lt;p&gt;As Open ID is unique to a user under an Official Account, a User ID is unique to a user under WeChat Work platform.&lt;/p&gt;

&lt;h3&gt;
  
  
  Mini-Program needs to be published to be bound to WeChat Work Account
&lt;/h3&gt;

&lt;p&gt;Before you can see how you can interact with your Mini-Program in WeChat Work, you will need to have a published Mini-Program.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h3&gt;
  
  
  WeChat Work Plugin in DevTool
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2AM4pF-1srmD_LcxZ5IjdewA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2AM4pF-1srmD_LcxZ5IjdewA.png"&gt;&lt;/a&gt;Find the plugin option under Tool tab&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F976%2F1%2A5vLh-rST1KanWs0gzwg7mg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F976%2F1%2A5vLh-rST1KanWs0gzwg7mg.png"&gt;&lt;/a&gt;Switch to 企业微信 mode&lt;/p&gt;

&lt;p&gt;Source: &lt;a href="https://developers.weixin.qq.com/miniprogram/dev/devtools/qywx-dev.html" rel="noopener noreferrer"&gt;https://developers.weixin.qq.com/miniprogram/dev/devtools/qywx-dev.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Similar to the limitation mentioned above, some functionalities are limited to a physical device.&lt;/p&gt;

&lt;h3&gt;
  
  
  Internal and External Contact
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Since you can add normal WeChat user through WeChat Work app, the users are divided into internal and external contacts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2AWo_1Zen1BYINmqgOUdEkYA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2AWo_1Zen1BYINmqgOUdEkYA.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Similar to how you set up &lt;a href="https://medium.com/china-software-development/build-your-wechat-chatbot-6e439d3c9650?source=your_stories_page---------------------------" rel="noopener noreferrer"&gt;WeChat Chatbot&lt;/a&gt; for Official Account, you would set up an endpoint to receive events. &lt;a href="https://work.weixin.qq.com/api/doc#90000/90135/90930" rel="noopener noreferrer"&gt;Official Doc&lt;/a&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;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.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F606%2F1%2A9HeyyKeOtvKK2_SnrWs4fw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F606%2F1%2A9HeyyKeOtvKK2_SnrWs4fw.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Not every employee will have access to external contact by default.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F676%2F1%2Ai7zNKspIn1ULaWEnrcYP4w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F676%2F1%2Ai7zNKspIn1ULaWEnrcYP4w.png"&gt;&lt;/a&gt;You will need to set it up in here&lt;/p&gt;

&lt;h3&gt;
  
  
  Jump in and out of Conversation
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2AOjV_iA99SGX1AAZ2RsJEYA.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2AOjV_iA99SGX1AAZ2RsJEYA.jpeg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You will be able to set the different pages that employee could open from the attachment&lt;/li&gt;
&lt;li&gt;You can get the userID of the conversation if the Mini-Program is opened from here, using the method below
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;wx.qy.getCurExternalContact({
 success: function(res) {
 var userId = res.userId

}
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Multiple API Secret and Token
&lt;/h3&gt;

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

&lt;ul&gt;
&lt;li&gt;For a syncing contact list&lt;/li&gt;
&lt;li&gt;For your Mini-program&lt;/li&gt;
&lt;li&gt;For your callback URL&lt;/li&gt;
&lt;li&gt;And more if you bind more Mini-Programs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Make sure you have the right user role, so you can see the full picture in the admin panel.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;If your organization already adopted WeChat Work, by all means, take advantage of the API and functionalities provided.&lt;/p&gt;

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

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;If you want to learn more about WeChat related software development, &lt;a href="https://pages.convertkit.com/b2469604dd/0c671fdd2d" rel="noopener noreferrer"&gt;click here for a free glossary&lt;/a&gt;.&lt;/p&gt;




</description>
      <category>softwaredevelopment</category>
      <category>business</category>
      <category>wechat</category>
      <category>china</category>
    </item>
  </channel>
</rss>
