Commit 9117933a by FengChen Committed by lanrion

add is_to_all support in sending mass message

parent 26ca43fe
......@@ -7,8 +7,8 @@ module WeixinAuthorize
# media_info= {"media_id" media_id}
# https://api.weixin.qq.com/cgi-bin/message/mass/sendall?access_token=ACCESS_TOKEN
def mass_with_group(group_id, media_info, msgtype="mpnews")
group_option = {"filter" => {"group_id" => group_id.to_s}}
def mass_with_group(group_id, media_info, msgtype="mpnews", is_to_all=false)
group_option = {"filter" => {"group_id" => group_id.to_s, "is_to_all" => is_to_all}}
media = generate_media(msgtype, media_info, group_option)
mass_url = "#{mass_base_url}/sendall"
......
......@@ -49,6 +49,11 @@ describe WeixinAuthorize::Api::Mass do
expect(response.code).to eq(WeixinAuthorize::OK_CODE)
end
it "#mass_with_groug send to all" do
response = $client.mass_with_group("1", "mass_group_text_to_all", "text", true)
expect(response.code).to eq(WeixinAuthorize::OK_CODE)
end
it "#mass_with_openids with mpnews and can delete message" do
response = $client.mass_with_openids([ENV["OPENID"]], mass_media_id)
expect(response.code).to eq(WeixinAuthorize::OK_CODE)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment