Open soulfly opened 6 years ago
@soulfly No. Currently it does not support the Broadcast API. Broadcast API is only available in v2.11 and this gem is still on v2.9. So it has to update to v2.11 first then it will be possible to support Broadcast API.
Thanks @amrutjadhav I have just created a monkey patch for this in a case somebody will need it
module Facebook
module Messenger
module Broadcast
include HTTParty
# Define base_uri for HTTParty.
base_uri 'https://graph.facebook.com/v2.11/me'
format :json
module_function
def create_message_creative(messages, access_token:)
response = post '/message_creatives',
body: JSON.dump(messages),
format: :json,
query: {
access_token: access_token
}
Facebook::Messenger::Bot::ErrorParser.raise_errors_from(response)
response.body
end
def send_broadcast(message_creative_id, notification_type, schedule_time, access_token:)
data = {:message_creative_id => message_creative_id,
:notification_type => notification_type}
data[:schedule_time] = schedule_time if schedule_time
response = post '/broadcast_messages',
body: JSON.dump(data),
format: :json,
query: {
access_token: access_token
}
Facebook::Messenger::Bot::ErrorParser.raise_errors_from(response)
response.body
end
end
end
end
Cool. I'll be happy to merge a pull request for this, too.
Does this gem support Broadcast API? https://developers.facebook.com/docs/messenger-platform/send-messages/broadcast-messages