A simple Ruby on Rails project hooking up with the Facebook Messenger Platform(Bots for Facebook Messenger)
Created a very basic RoR project with:
$ ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [i686-linux]
$ bin/rails -v
Rails 4.2.5
$ bin/rails new learn_facebook_messenger_chatbot
$ bin/rails generate controller webhooks/facebook_messenger verify chat
web-hooks for integration:
$ bin/rake routes
Prefix Verb URI Pattern Controller#Action
webhooks_facebook_messenger GET /webhooks/facebook_messenger(.:format) webhooks/facebook_messenger#verify
POST /webhooks/facebook_messenger(.:format) webhooks/facebook_messenger#chat
webhooks_facebook_messenger_weather GET /webhooks/facebook_messenger_weather(.:format) webhooks/facebook_messenger_weather#verify
POST /webhooks/facebook_messenger_weather(.:format) webhooks/facebook_messenger_weather#chat
run:
$ fb_verify_token='ABC' fb_access_token='XYZ' bin/rails server
See Also:
- How To Build Bots for Messenger
- Messenger Platform: Getting Started
- Facebook Messenger bot 15 minute tutorial
- The example weather app on Wit.ai
TODO:
- Templates: Receipt, Quick replies
- Error handling
- Test cases