facebook-bot
Very easy Ruby on Rails client!! for Facebook Messenger Platform
Requires Rails >= 4.2.0
Installation
Bundler in your Gemfile.
gem 'facebook-bot'
Quickstart
#config/initializers/facebook_bot.rb
Facebook::Bot.config do |config|
config.access_token = <ACCESS_TOKEN>
config.validation_token = <VERIFY_TOKEN>
end
#config/routes.rb
mount Facebook::Bot::Space => "/webhook"
Example
#app/models/facebook_bot.rb
class FacebookBot
Facebook::Bot.on("message") do |event, sender|
sender.reply({ text: "Reply: #{event['message']['text']}" })
end
Facebook::Bot.on("delivery") do |event, sender|
#BlahBlah
end
Facebook::Bot.on("postback") do |event, sender|
#BlahBlah
end
end
license
MIT, see LICENSE.txt