当前位置:网站首页>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
边栏推荐
- Cooperative development in embedded -- function pointer
- 颜值爆表,推荐两款JSON可视化工具,配合Swagger使用真香
- MySQL combat optimization expert 12 what does the memory data structure buffer pool look like?
- Vh6501 Learning Series
- MySQL实战优化高手03 用一次数据更新流程,初步了解InnoDB存储引擎的架构设计
- 16 medical registration system_ [order by appointment]
- Compress decompress
- 在CANoe中通过Panel面板控制Test Module 运行(高级)
- C杂讲 双向循环链表
- The replay block of canoe still needs to be combined with CAPL script to make it clear
猜你喜欢
16 medical registration system_ [order by appointment]
CAPL script pair High level operation of INI configuration file
MySQL實戰優化高手04 借著更新語句在InnoDB存儲引擎中的執行流程,聊聊binlog是什麼?
CAPL script printing functions write, writeex, writelineex, writetolog, writetologex, writedbglevel do you really know which one to use under what circumstances?
Write your own CPU Chapter 10 - learning notes
The replay block of canoe still needs to be combined with CAPL script to make it clear
Southwest University: Hu hang - Analysis on learning behavior and learning effect
Contest3145 - the 37th game of 2021 freshman individual training match_ C: Tour guide
Target detection -- yolov2 paper intensive reading
Programmation défensive en langage C dans le développement intégré
随机推荐
A new understanding of RMAN retention policy recovery window
MySQL实战优化高手12 Buffer Pool这个内存数据结构到底长个什么样子?
CAPL script pair High level operation of INI configuration file
vscode 常用的指令
MySQL实战优化高手07 生产经验:如何对生产环境中的数据库进行360度无死角压测?
MySQL实战优化高手09 生产经验:如何为生产环境中的数据库部署监控系统?
在CANoe中通過Panel面板控制Test Module 運行(初級)
MySQL实战优化高手10 生产经验:如何为数据库的监控系统部署可视化报表系统?
17 medical registration system_ [wechat Payment]
Keep these four requirements in mind when learning single chip microcomputer with zero foundation and avoid detours
[one click] it only takes 30s to build a blog with one click - QT graphical tool
CDC: the outbreak of Listeria monocytogenes in the United States is related to ice cream products
MySQL实战优化高手06 生产经验:互联网公司的生产环境数据库是如何进行性能测试的?
安装OpenCV时遇到的几种错误
How to make shell script executable
Download address of canoe, download and activation of can demo 16, and appendix of all canoe software versions
The governor of New Jersey signed seven bills to improve gun safety
如何让shell脚本变成可执行文件
CAPL script printing functions write, writeex, writelineex, writetolog, writetologex, writedbglevel do you really know which one to use under what circumstances?
四川云教和双师模式