Module: WxExt::Api::CustomerService

Extended by:
CustomerService
Included in:
CustomerService
Defined in:
lib/wx_ext/api/customer_service.rb

Overview

User api of weixin.

Author:

  • FuShengYang

Instance Method Summary collapse

Instance Method Details

#reply_msg(access_token, to_user_openid, msg_type, msg_hash) ⇒ Hash

Reply msg via post.

Parameters:

  • access_token (Enumerable<String>)
  • to_user_openid (Enumerable<String>)
  • msg_type (Enumerable<String>)
  • msg_hash (Hash)

Returns:

  • (Hash)

    Json based hash.



21
22
23
24
25
26
27
28
29
30
# File 'lib/wx_ext/api/customer_service.rb', line 21

def reply_msg(access_token, to_user_openid, msg_type, msg_hash)
  url = 'https://api.weixin.qq.com/cgi-bin/message/custom/send'\
        "?access_token=#{access_token}"
  msg_hash = {
    :touser => to_user_openid,
    :msgtype => msg_type,
    "#{msg_type}".to_sym => msg_hash
  }
  Helper.http_post(url, msg_hash.to_json)
end