Very popular enterprise WeChat daily push super detailed nanny class tutorial
Write in front
-
The title of the test number cannot be modified to a user-defined name, and the test number's avatar cannot be modified -
The pushed message can only be received by clicking the subscription number. After clicking the subscription number, the message will be sent from the list -
You must customize the template every time you want to modify the content -
The official of Tencent, the WeChat test account, made a clear announcement that this channel would be closed, which may lead to unavailability at any time -
Many tests do not report errors, but the push fails. Most of the reasons are inferred to be the unstable test number
Terminology
-
Enterprise WeChat is not only applicable to enterprises, but also to individuals , but some functions are restricted without authentication, which does not affect the use of this tutorial. -
Hefeng weather platform, which is a third-party platform for obtaining weather forecast, we register this platform and Real name authentication After that, you can get the weather forecast data for free, but there is a limit on the number of weather forecast data every day, which is subject to the official. If it is an individual who pushes news every day, it is enough. -
Enterprise application: after registering enterprise WeChat, we can create an enterprise application, and then push messages through this application. You can simply understand that the enterprise WeChat application here ≈ WeChat official account -
Enterprise trusted IP: Full name enterprise trusted IP address. To ensure the security of enterprise applications, Tencent has set the enterprise trusted IP address. Only the address added to the enterprise trusted IP can use the program to push messages.
Effect Preview
Tutorial Steps
1. Registered enterprise WeChat
2. Log in to the enterprise WeChat background
3. Create message push application
4. Fill in the enterprise trusted IP
-
For example, if I use my own computer to run the push program, I need to fill in the IP results in Baidu directly, or click the link to query the IP directly( Click this query IP ) -
For example, if I want to use ECS to run push programs, I need to fill in the IP address of the server
5. Application and Wind Weather Key
-
Open the Peace Weather Official https://id.qweather.com/#/login , it is recommended to directly use WeChat login to register After the first registration is completed, the mobile phone number and email address should be bound as required, otherwise the KEY cannot be applied. After completing the above steps, find and click Account settings for more Hefeng products -> Hefeng Weather Developer Console 。 -
Click Application Management on the left ->Create Application ->Free Developer Edition ->Enter Application Name ->Web API ->Enter KEY Name ->Complete Creation, Find the value of KEY to record, and we will use it later 。
6. Configurator Parameters
"Wxid": the enterprise WeChat ID we obtained by logging in the enterprise WeChat in the second step
"Agent id": the agent id obtained from the enterprise WeChat application we applied for in the previous step 3
"Secret": the secret obtained from the enterprise WeChat application we applied for in the previous step 3
"Qweather": the key of moderate wind weather we applied for in step 5 above
SYS_CONFIG = { #Enterprise WeChat Enterprise ID, required application address: https://work.weixin.qq.com/ "wxid": "", #Enterprise WeChat application AgentId, required "agentid": "", #Enterprise WeChat application Secret, required "secret": "", #Hefeng Weather Key, not required application address: https://id.qweather.com/#/login "qweather": "", #Weather forecast address, not required #Format: city city/county/district, multiple addresses are separated by&& #For example, Chengdu Shuangliu&Chengdu Wuhou "City": "Chengdu Wuhou", #Anniversary name, not required #Recurring days, which occur every year. Multiple dates are separated by&& #For example, the birthday of a formal girlfriend&the birthday of a junior "Targetname": "The birthday of an official girlfriend&the birthday of a mistress", #Anniversary date, not required #Gregorian calendar format 20XX-XX-XX, add n before the lunar year #Multiple dates are separated by&&. Note that they correspond to the targetname name #For example: 2022-08-10&&n2021-08-15 "targetday": "2022-08-10&&n2021-08-15", #Single day project name, not required #Days that only occur once, only days in a certain year, and multiple dates are separated by&& #For example: meet with the mistress "Beginname": "Meet", #Single day date, not required #Gregorian calendar format 20XX-XX-XX, add n before the lunar year #Multiple dates are separated by&&. Note that they correspond to the beginname name #For example: 2022-08-15&&n2022-12-10 "beginday": "n2022-12-10", #Image text type, not required #1 refers to single image and text, 2 refers to multiple images and text, and the default is single image and text "msgtype": "1" }
7. Run program
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple python send.py
8. Configure mobile WeChat to receive messages
-
Send the QR code of invitation to follow to TA, scan the mobile WeChat code to follow, and you will be prompted "click to verify your identity and join XXXX". After verification, you can receive the follow-up message. -
Enterprise WeChat background - My enterprise - WeChat plug-in , WeChat plug-in logo can be customized, that is, you can see the enterprise's image from WeChat Find the QR code inviting attention, scan the code with personal WeChat, and set Allow members to receive and reply to chat messages in WeChat plug-ins tick -
The enterprise WeChat mobile terminal finds ->Settings ->New message notification ->Receive messages only in enterprise WeChat ->Uncheck all ->Finish -
You can receive push messages on WeChat without accident
receive information
common problem
1、“No module named requests”?
2. "Failed to obtain enterprise WeChat access_token"?
3. Did you not find XX/failed to obtain XXID?
4. Other errors?
5. How to modify a template?
6. Some contents are not fully displayed?
listen for
The code is efficient, a public account with many interesting black technologies, follow me, and continue to share more high-quality resources for you!
Disclaimer: All software, tutorials and content information provided by this public account are only for learning and research purposes; The above contents shall not be used for commercial or illegal purposes, otherwise, the user shall bear all consequences. The information of this public account is collected and collated from the network, and the copyright dispute has nothing to do with this public account. You must completely delete the above content from your computer or phone within 24 hours after downloading. If you like the program and content, please support the genuine, purchase and register, and get better genuine services. We attach great importance to copyright issues. If there is any infringement, please contact us in the public account window. Please understand!