The applet obtains the enterprise WeChat QR code, and uses the contact me plug-in to configure the enterprise WeChat QR code

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:
insert image description here
insert image description here



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
insert image description here
insert image description here

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

insert image description here
Parameters and return results:
insert image description here
debugging:
insert image description here
insert image description here

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
insert image description here
parameters and return results:
insert image description here
debugging:
insert image description here

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
insert image description here
return result:
insert image description here
You can directly use the obtained qr_code without using a plug-in to directly display the enterprise WeChat QR code
insert image description here

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.
insert image description here
Enterprise Client Plugin
insert image description here

Using plugins in uniapp

"plugins": {
    
    
	"contactPlugin": {
    
    
		"version": "1.4.3",
		"provider": "wx104a1a20c3f81ec2"
	}
}  

insert image description here

Add a reference to the component

"usingComponents": {
    
    
	"cell": "plugin://contactPlugin/cell"
}

insert image description here
use in the page

<cell bind:startmessage='startmessage' bind:completemessage="completemessage" plugid='plugid'  />


Final effect:
insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/m0_47791238/article/details/130784168