Class: MpWeixin::Interface::Message
- Defined in:
- lib/mp_weixin/interface/message.rb
Overview
发送消息
Instance Method Summary collapse
-
#custom_send(opts = nil) ⇒ Object
发送客服消息 文本消息:.
Methods inherited from Base
#default_request_params, #get, #initialize, #post, #request
Constructor Details
This class inherits a constructor from MpWeixin::Interface::Base
Instance Method Details
#custom_send(opts = nil) ⇒ Object
发送客服消息 文本消息:
{
"touser":"OPENID",
"msgtype":"text",
"text":
{
"content":"Hello World"
}
}
发送图片消息: {
"touser":"OPENID",
"msgtype":"image",
"image":
{
"media_id":"MEDIA_ID"
}
} etc
30 31 32 33 34 35 |
# 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 |