Obtaining the corporate WeChat QR code through configuration is divided into five steps:
the first step: log in to the corporate WeChat management background, and query the corporate ID (corpid) and Secret (corpsecret) of corporate WeChat;
the second step: obtain access_token;
the third step: Generate config_id through employee ID configuration (that is, enterprise WeChat contact me plugid);
Step 4: Obtain the "Contact Me" method configured by the enterprise through config_id;
Step 5: Use the Contact Me plug-in to generate enterprise WeChat QR code according to config_id;
Renderings:
Table of contents
- 1. Log in to the corporate WeChat management background, and query the corporate ID (corpid) and Secret (corpsecret) of corporate WeChat
- 2. Get access_token
- 3. Generate config_id through employee ID configuration (that is, enterprise WeChat contact me plugid)
- 4. Obtain the "Contact Me" method configured by the enterprise through config_id
- 5. Use the contact me plug-in to generate the enterprise WeChat QR code according to config_id
1. Log in to the corporate WeChat management background, and query the corporate ID (corpid) and Secret (corpsecret) of corporate WeChat
Find the company's WeChat management background personnel, log in to the corporate WeChat management background, and query the company ID and Secret
Enterprise login link: https://work.weixin.qq.com/wework_admin/loginpage_wx?from=myhome_help
2. Get access_token
Related document link: https://developer.work.weixin.qq.com/document/path/91039
Request method: GET (HTTPS)
request address: https://qyapi.weixin.qq.com/cgi-bin/gettoken ?corpid=ID&corpsecret=SECRET
Note:
For security reasons, developers should not return the access_token to the front end, developers need to save it in the background, and all requests to access the enterprise WeChat API are initiated by the background
Parameters and return results:
debugging:
3. Generate config_id through employee ID configuration (that is, enterprise WeChat contact me plugid)
Note: (The config_id for configuration production needs to be stored in the backend to facilitate subsequent additions, deletions, modifications and inquiries)
The "Contact Me" added through the API will not be displayed on the management side, and each enterprise can configure up to 500,000 "Contact Me" through the API.
The user needs to properly store the returned config_id. If the config_id is lost, the user may not be able to edit or delete "Contact Me".
Temporary conversation mode does not occupy the number of "contact me", but it can add up to 100,000 per day, and only supports a single person.
The QR code of the temporary conversation mode, the QR code will be invalid immediately after adding friends.
Related document link: https://developer.work.weixin.qq.com/document/path/92228
Request method: POST (HTTPS)
request address:
https://qyapi.weixin.qq.com/cgi-bin/externalcontact /add_contact_way?access_token=ACCESS_TOKEN
parameters and return results:
debugging:
4. Obtain the "Contact Me" method configured by the enterprise through config_id
Document link: https://developer.work.weixin.qq.com/document/path/92228
Request method: POST (HTTPS)
request address:
https://qyapi.weixin.qq.com/cgi-bin/externalcontact/ get_contact_way?access_token=ACCESS_TOKEN
return result:
You can directly use the obtained qr_code without using a plug-in to directly display the enterprise WeChat QR code
5. Use the contact me plug-in to generate the enterprise WeChat QR code according to config_id
Official link: https://developer.work.weixin.qq.com/document/path/93582
1. Log in to the public platform of the Mini Program and
add the plug-in for enterprise customer service. ->Third-party service->Plug-in management->Add plug-in, search and add plug-in ID: wx104a1a20c3f81ec2, no need to review and confirm.
Enterprise Client Plugin
Using plugins in uniapp
"plugins": {
"contactPlugin": {
"version": "1.4.3",
"provider": "wx104a1a20c3f81ec2"
}
}
Add a reference to the component
"usingComponents": {
"cell": "plugin://contactPlugin/cell"
}
use in the page
<cell bind:startmessage='startmessage' bind:completemessage="completemessage" plugid='plugid' />
Final effect: