Commit 25cf7b25 by lanrion

添加模板消息接口

parent 5ef7b637
...@@ -5,3 +5,4 @@ require "weixin_authorize/api/groups" ...@@ -5,3 +5,4 @@ require "weixin_authorize/api/groups"
require "weixin_authorize/api/qrcode" require "weixin_authorize/api/qrcode"
require "weixin_authorize/api/media" require "weixin_authorize/api/media"
require "weixin_authorize/api/oauth" require "weixin_authorize/api/oauth"
require "weixin_authorize/api/template"
# encoding: utf-8
module WeixinAuthorize
module Api
module Template
# 设置所属行业
def set_template_industry(industry_id1, industry_id2)
industries = {industry_id1: industry_id1, industry_id2: industry_id2}
http_post("/template/api_set_industry", industries)
end
# 获得模板ID
# code: 模板库中模板的编号,有“TM**”和“OPENTMTM**”等形式
def add_template(code)
http_post("/template/api_add_template", template_id_short: code)
end
# 发送模板消息
def send_template_msg(touser, template_id, url, topcolor, data)
msg = {
touser: touser, template_id: template_id,
url: url, topcolor: topcolor, data: data
}
http_post("/message/template/send", msg)
end
end
end
end
...@@ -11,6 +11,7 @@ module WeixinAuthorize ...@@ -11,6 +11,7 @@ module WeixinAuthorize
include Api::Qrcode include Api::Qrcode
include Api::Media include Api::Media
include Api::Oauth include Api::Oauth
include Api::Template
attr_accessor :app_id, :app_secret, :expired_at # Time.now + expires_in attr_accessor :app_id, :app_secret, :expired_at # Time.now + expires_in
attr_accessor :access_token, :redis_key attr_accessor :access_token, :redis_key
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment