07-Template message settings

07-Template message settings

table of Contents

1. Basic settings of template message

1.1. Set industry

1.2. Obtain the set industry information

1.3. Template creation


 

1. Basic settings of template message

Before setting the template message, we need to read the specification of the template message in the development document in detail.

The specification of the template message in the development document is as follows.

 

https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Template_Message_Interface.html#1

note:

所有服务号都可以在功能->添加功能插件处看到申请模板消息功能的入口,但只有认证后的服务号才可以申请模板消息的使用权限并获得该权限;
需要选择公众账号服务所处的2个行业,每月可更改1次所选行业;
在所选择行业的模板库中选用已有的模板进行调用;
每个账号可以同时使用25个模板。
当前每个账号的模板消息的日调用上限为10万次,单个模板没有特殊限制。
【2014年11月18日将接口调用频率从默认的日1万次提升为日10万次,可在MP登录后的开发者中心查看】。
当账号粉丝数超过10W/100W/1000W时,模板消息的日调用上限会相应提升,以公众号MP后台开发者中心页面中标明的数字为准

1.1. Set industry

 

Interface call request description

https://api.weixin.qq.com/cgi-bin/template/api_set_industry?access_token=ACCESS_TOKEN

 

 

 

I will not write the function of setting the industry separately, but call the post request.

 

POST data description

Examples of POST data are as follows:

Note: For industry settings, please refer to the development template of the WeChat official account.

{
    "industry_id1":"1",   
    "industry_id2":"4"    
}

 

For the serial number, please refer to the development document provided by the WeChat official account (see the document header), which has the corresponding meaning of each parameter.

I will call directly (using postman)

1.2. Obtain the set industry information

 

Interface call request description

 

https://api.weixin.qq.com/cgi-bin/template/get_industry?access_token=ACCESS_TOKEN

The call result is shown in the figure below.

1.3. Template creation

 

It is written in the formal environment that you can choose the corresponding template (I haven't used the formal environment for the time being)

The test environment is configured on the test official account

{
   
   {first.DATA}} 
模板编号:{
   
   {xid.DATA}} 
测试人员:{
   
   {name.DATA}} 
测试时间:{
   
   {time.DATA}}

There will be a template id after configuration

Then use postman to call and test to send template information

 

The calling address of the template information is as follows

 

https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN

The request message is as follows:

 {
           "touser":"orxnH5wNRLvz2DfNTopTGcL4y9ic", // 发给谁对应的openid 在关注我的人中可以找到
           "template_id":"6D-9BxKgoCf_c6aINnqaOsSHUHhgV2---DujiG-FQd0", //在创建模板的时候就自动生成的模板id
           "url":"http://www.baidu.com/",  //模板消息点击详情信息会跳转的url
           "data":{          // 模板消息封装的数据
                   "first": {                  // 对应模板信息中的{
   
   {first.DATA}}}
                       "value":"恭喜你测试成功!",
                       "color":"#173177"
                   },
                   "xid":{                      // 对应模板信息中的{
   
   {xid.DATA}}} 
                       "value":"01",
                       "color":"#173177"
                   },
                   "name": {                    // 对应模板信息中的{
   
   {name.DATA}}} 
                       "value":"万博",
                       "color":"#173177"
                   },
                   "time": {                   // 对应模板信息中的{
   
   {time.DATA}}} 
                       "value":"2014年9月22日",
                       "color":"#173177"
                   }
           }
       }

I received the corresponding template information on the WeChat official account.

 

 

 

Guess you like

Origin blog.csdn.net/baidu_31572291/article/details/114338610