class MpWeixin::Interface::Message

发送消息

Public Instance Methods

custom_send(opts = nil) click to toggle source

发送客服消息 文本消息:

{

"touser":"OPENID",
"msgtype":"text",
"text":
{
     "content":"Hello World"
}

}

发送图片消息: {

"touser":"OPENID",
"msgtype":"image",
"image":
{
  "media_id":"MEDIA_ID"
}

} etc @see mp.weixin.qq.com/wiki/index.php?title=%E5%8F%91%E9%80%81%E5%AE%A2%E6%9C%8D%E6%B6%88%E6%81%AF

# File lib/mp_weixin/interface/message.rb, line 30
def custom_send(opts = nil)
  # JSON.generate(user_message.protocol_params, :ascii_only => true)
  opts_json = JSON.generate(opts, :ascii_only => false) if opts.is_a?(Hash)

  post '/cgi-bin/message/custom/send', :body => opts_json, :params => default_request_params
end