当前位置:网站首页>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
边栏推荐
- Compress decompress
- VH6501学习系列文章
- 在CANoe中通过Panel面板控制Test Module 运行(初级)
- Contest3145 - the 37th game of 2021 freshman individual training match_ C: Tour guide
- Hugo blog graphical writing tool -- QT practice
- 嵌入式開發中的防禦性C語言編程
- 如何让shell脚本变成可执行文件
- CAPL脚本中关于相对路径/绝对路径操作的几个傻傻分不清的内置函数
- The replay block of canoe still needs to be combined with CAPL script to make it clear
- MySQL real battle optimization expert 08 production experience: how to observe the machine performance 360 degrees without dead angle in the process of database pressure test?
猜你喜欢
51单片机进修的一些感悟
软件测试工程师必备之软技能:结构化思维
Carolyn Rosé博士的社交互通演讲记录
MySQL实战优化高手12 Buffer Pool这个内存数据结构到底长个什么样子?
CANoe下载地址以及CAN Demo 16的下载与激活,并附录所有CANoe软件版本
MySQL實戰優化高手04 借著更新語句在InnoDB存儲引擎中的執行流程,聊聊binlog是什麼?
MySQL的存储引擎
MySQL实战优化高手04 借着更新语句在InnoDB存储引擎中的执行流程,聊聊binlog是什么?
The programming ranking list came out in February. Is the result as you expected?
15 医疗挂号系统_【预约挂号】
随机推荐
The replay block of canoe still needs to be combined with CAPL script to make it clear
[flask] crud addition and query operation of data
The real future of hardware engineers may not be believed by you if I say so
嵌入式開發中的防禦性C語言編程
CAPL script printing functions write, writeex, writelineex, writetolog, writetologex, writedbglevel do you really know which one to use under what circumstances?
Target detection -- yolov2 paper intensive reading
C miscellaneous lecture continued
Routes and resources of AI
Control the operation of the test module through the panel in canoe (Advanced)
Some thoughts on the study of 51 single chip microcomputer
C杂讲 浅拷贝 与 深拷贝
软件测试工程师发展规划路线
Single chip microcomputer realizes modular programming: Thinking + example + system tutorial (the degree of practicality is appalling)
MySQL实战优化高手07 生产经验:如何对生产环境中的数据库进行360度无死角压测?
Sichuan cloud education and double teacher model
13 medical registration system_ [wechat login]
Cooperative development in embedded -- function pointer
Elk project monitoring platform deployment + deployment of detailed use (II)
Flash operation and maintenance script (running for a long time)
MySQL实战优化高手04 借着更新语句在InnoDB存储引擎中的执行流程,聊聊binlog是什么?