Module: WeixinAuthorize::Api::Mass
- Included in:
- Client
- Defined in:
- lib/weixin_authorize/api/mass.rb
Constant Summary collapse
- MSG_TYPE =
["mpnews", "image", "text", "voice", "mpvideo"].freeze
Instance Method Summary collapse
-
#mass_delete_with_msgid(msg_id) ⇒ Object
另外,删除群发消息只能删除图文消息和视频消息,其他类型的消息一经发送,无法删除。.
-
#mass_get_status(msg_id) ⇒ Object
查询群发消息发送状态【订阅号与服务号认证后均可用】.
-
#mass_preview(openid, media_info, msg_type = "mpnews") ⇒ Object
预览接口【订阅号与服务号认证后均可用】.
-
#mass_with_group(group_id, media_info, msgtype = "mpnews", is_to_all = false) ⇒ Object
media_info= media_id api.weixin.qq.com/cgi-bin/message/mass/sendall?access_token=ACCESS_TOKEN.
-
#mass_with_openids(openids, media_info, msgtype = "mpnews") ⇒ Object
api.weixin.qq.com/cgi-bin/message/mass/send?access_token=ACCESS_TOKEN if mpvideo, media_info= => media_id, “title” => “title”, “description” => “description”.
Instance Method Details
#mass_delete_with_msgid(msg_id) ⇒ Object
另外,删除群发消息只能删除图文消息和视频消息,其他类型的消息一经发送,无法删除。
30 31 32 33 |
# File 'lib/weixin_authorize/api/mass.rb', line 30 def mass_delete_with_msgid(msg_id) mass_url = "#{mass_base_url}/delete" http_post(mass_url, {msg_id: msg_id}) end |
#mass_get_status(msg_id) ⇒ Object
查询群发消息发送状态【订阅号与服务号认证后均可用】
44 45 46 47 |
# File 'lib/weixin_authorize/api/mass.rb', line 44 def mass_get_status(msg_id) mass_url = "#{mass_base_url}/get" http_post(mass_url, {"msg_id" => msg_id}) end |
#mass_preview(openid, media_info, msg_type = "mpnews") ⇒ Object
预览接口【订阅号与服务号认证后均可用】
36 37 38 39 40 41 |
# File 'lib/weixin_authorize/api/mass.rb', line 36 def mass_preview(openid, media_info, msg_type="mpnews") openid_option = {touser: openid} media = generate_media(msg_type, media_info, openid_option) mass_url = "#{mass_base_url}/preview" http_post(mass_url, media) end |
#mass_with_group(group_id, media_info, msgtype = "mpnews", is_to_all = false) ⇒ Object
media_info= media_id api.weixin.qq.com/cgi-bin/message/mass/sendall?access_token=ACCESS_TOKEN
10 11 12 13 14 15 16 |
# File 'lib/weixin_authorize/api/mass.rb', line 10 def mass_with_group(group_id, media_info, msgtype="mpnews", is_to_all=false) group_option = {filter: {group_id: group_id, is_to_all: is_to_all}} media = generate_media(msgtype, media_info, group_option) mass_url = "#{mass_base_url}/sendall" http_post(mass_url, media) end |
#mass_with_openids(openids, media_info, msgtype = "mpnews") ⇒ Object
api.weixin.qq.com/cgi-bin/message/mass/send?access_token=ACCESS_TOKEN if mpvideo, media_info= => media_id, “title” => “title”, “description” => “description”
21 22 23 24 25 26 |
# File 'lib/weixin_authorize/api/mass.rb', line 21 def mass_with_openids(openids, media_info, msgtype="mpnews") openid_option = {touser: openids} media = generate_media(msgtype, media_info, openid_option) mass_url = "#{mass_base_url}/send" http_post(mass_url, media) end |