Sha256: b89dfbbecdd219cc3c8335602c7f77059fa367dc8f64ebd687b8364652d89af3
Contents?: true
Size: 1.05 KB
Versions: 3
Compression:
Stored size: 1.05 KB
Contents
module Messenger module Bot class Transmitter def initialize(sender) @sender_id = sender end def reply(data) data = init_data.merge({ message: data }) Messenger::Bot::Request.post("https://graph.facebook.com/v2.6/me/messages?access_token=#{Messenger::Bot::Config.access_token}", data) end def get_profile(fields=nil) fields ||= [:locale, :timezone, :gender, :first_name, :last_name, :profile_pic] Messenger::Bot::Request.get("https://graph.facebook.com/v2.6/#{@sender_id}?fields=#{fields.join(",")}&access_token=#{Messenger::Bot::Config.access_token}") end def action(sender_action=true) data = init_data.merge({ sender_action: sender_action ? "typing_on" : "typing_off" }) Messenger::Bot::Request.post("https://graph.facebook.com/v2.6/me/messages?access_token=#{Messenger::Bot::Config.access_token}", data) end private def init_data { recipient: { id: @sender_id } } end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
messenger-bot-1.0.3.2 | lib/messenger/bot/transmitter.rb |
messenger-bot-1.0.3.1 | lib/messenger/bot/transmitter.rb |
messenger-bot-1.0.3 | lib/messenger/bot/transmitter.rb |