当前位置:网站首页>Super detailed steps for pushing wechat official account H5 messages
Super detailed steps for pushing wechat official account H5 messages
2022-07-06 10:10:00 【Eric-x】
Preface
Some time ago, I made a project for H5 Message push function , It is hereby recorded that , Interested or needed friends can check , Because the code is not difficult , I think what is difficult for beginners is some concepts and specific implementation process , So I will use the test interface provided by wechat to go through the process first , The corresponding implementation code will be posted later , In this way, both you and I will have a clearer understanding of the implementation of the overall process , If there is anything wrong, please point out ( Hug and thank you )
The renderings are as follows :
Article title
List of articles
1、 Concept
I think we must understand the concept of some keywords in the document before docking with the third-party interface , The meaning of , In this way, I won't be confused by the documents ( In fact, I was confused when I read the third-party interface documents , Especially wechat , Make complaints about it here. , Alibaba's documents are better , Easy to understand )
I won't say much here , Briefly introduce several concepts used in our function : Wechat service number official document link
We try to focus here , Nothing else
1、Access token
access_token The official account is the only global interface invoke credential. , Official account calls for interfaces. access_token.
This sentence is officially said , In fact, we can understand it as :token It's the ID card of the service number , Have uniqueness , And this credential requires our service number APPID and secret These two values are obtained . In fact, there is another value ,grant_type, I won't say much about this value , There are many introductions on the Internet , obtain access_token Fill in client_credential that will do .
2、APPID
Third party user unique credentials , As long as we open the service number, we will have this thing
3、secret
Third party user unique credential key , namely appsecret
The official introduction is as follows :
APPID and secret When we register the service number, we can get , So with these two values , We can use these two values to request the official link to get our token
2、 obtain Token
For learners , It's still hard to apply for a service number , therefore , Wechat officials are very considerate to give us the interface for testing : Wechat development test interface 、 Go to this link , Log in with wechat scanning code , You can get :APPID and appsecret 了
Then we can provide through wechat Test interface , Take us APPID and APPsecret Fill in , We can get our token 了 ,token The default validity period is two hours , as follows
3、 Add message template
We have taken the first step above , Then this is not enough , If you need to pay attention to our service number ( official account ) Send messages to users of , We need a message template , The template is added here
Here to take care of beginners , I put my test template content here for you to copy directly
{
{
first.DATA}}
Inform the content :{
{
keyword1.DATA}}
{
{
remark.DATA}}
4、 Get the user's openId
About openId, Here's a special note ,openId It is aimed at users , With our service number APPID It doesn't matter ( I got confused about this at the beginning ), Our wechat only needs to pay attention to a official account , Then this official account will be assigned to our wechat openId, It's the only one , Here's the thing to note , Even if we cancel our attention , The second time I paid attention to that openid Or before , It won't change .
Because we are notifying the designated users , Then we need to get the user's openId
5、 test
good , Now we have everything , You can test directly , still , Open up our Wechat debugging tools
1、 Get our... First token, Input APPID And secret key , Click directly to get , Then it will automatically generate Token, We directly copy and retain
2、 Hang to send details to users , Then take token And message content
The above is the general process and idea , Know the specific implementation process , Then the code is not difficult to write , Write the corresponding code next time
边栏推荐
- 在CANoe中通過Panel面板控制Test Module 運行(初級)
- CANoe不能自动识别串口号?那就封装个DLL让它必须行
- Listen to my advice and learn according to this embedded curriculum content and curriculum system
- Installation de la pagode et déploiement du projet flask
- South China Technology stack cnn+bilstm+attention
- CANoe CAPL文件操作目录合集
- Download address of canoe, download and activation of can demo 16, and appendix of all canoe software versions
- C杂讲 浅拷贝 与 深拷贝
- Why can't TN-C use 2p circuit breaker?
- C杂讲 动态链表操作 再讲
猜你喜欢
Control the operation of the test module through the panel in canoe (primary)
13 医疗挂号系统_【 微信登录】
The programming ranking list came out in February. Is the result as you expected?
Listen to my advice and learn according to this embedded curriculum content and curriculum system
cmooc互联网+教育
Target detection -- yolov2 paper intensive reading
Installation of pagoda and deployment of flask project
CAPL 脚本打印函数 write ,writeEx ,writeLineEx ,writeToLog ,writeToLogEx ,writeDbgLevel 你真的分的清楚什么情况下用哪个吗?
PR 2021 quick start tutorial, first understanding the Premiere Pro working interface
Some thoughts on the study of 51 single chip microcomputer
随机推荐
History of object recognition
NLP路线和资源
华南技术栈CNN+Bilstm+Attention
MySQL实战优化高手09 生产经验:如何为生产环境中的数据库部署监控系统?
max-flow min-cut
颜值爆表,推荐两款JSON可视化工具,配合Swagger使用真香
Defensive C language programming in embedded development
MySQL combat optimization expert 07 production experience: how to conduct 360 degree dead angle pressure test on the database in the production environment?
cmooc互联网+教育
Tianmu MVC audit I
Zsh configuration file
13 medical registration system_ [wechat login]
在CANoe中通过Panel面板控制Test Module 运行(高级)
AI的路线和资源
PR 2021 quick start tutorial, first understanding the Premiere Pro working interface
竞赛vscode配置指南
MySQL的存储引擎
C miscellaneous dynamic linked list operation
MySQL ERROR 1040: Too many connections
oracle sys_ Context() function