module WxExt::Api::TemplateMsg

User api of weixin.

@author FuShengYang

Public Instance Methods

get_template_id(access_token, template_id_short) click to toggle source

Get the template ID via post.

@param [Enumerable<String>] access_token @param [Enumerable<String>] template_id_short @return [Hash] Json based hash.

# File lib/wx_ext/api/template_msg.rb, line 31
def get_template_id(access_token, template_id_short)
  url = 'https://api.weixin.qq.com/cgi-bin/template/api_add_template'\
        "?access_token=#{access_token}"
  Helper.http_post(url, { template_id_short: template_id_short })
end
send_template_msg(access_token, template_msg_hash) click to toggle source

Send the template msg via post.

@param [Enumerable<String>] access_token @param [Hash] template_msg_hash @return [Hash] Json based hash.

# File lib/wx_ext/api/template_msg.rb, line 42
def send_template_msg(access_token, template_msg_hash)
  url = 'https://api.weixin.qq.com/cgi-bin/message/template/send'\
        "?access_token=#{access_token}"
  Helper.http_post(url, template_msg_hash.to_json)
end
set_industry(access_token, industry_id1, industry_id2) click to toggle source

Set the industry via post.

@param [Enumerable<String>] access_token @param [Enumerable<String>] industry_id1 @param [Enumerable<String>] industry_id2 @return [Hash] Json based hash.

# File lib/wx_ext/api/template_msg.rb, line 20
def set_industry(access_token, industry_id1, industry_id2)
  url = 'https://api.weixin.qq.com/cgi-bin/template/api_set_industry'\
        "?access_token=#{access_token}"
  Helper.http_post(url, { industry_id1: industry_id1, industry_id2: industry_id2 }.to_json)
end