Coder Social home page Coder Social logo

fbbot's Introduction

FBBot - the Ruby Hack Night Facebook Bot

Slides and assets for the FBBot workshop [first presented at Toronto Ruby Hack Night, June 30, 2016]
Workshop for learning Chatbots, Facebook messaging and Wit.ai Created by David Andrews and Jason Schweier

Slides for the workshop are here: FYI remarkise doesn't work in Safari, sorry
https://gnab.github.io/remark/remarkise?url=https://raw.githubusercontent.com/k00ka/fbbot/master/SLIDES.md

###Introduction This project is a simple Ruby project. The workshop comes in four parts:

  1. create a Facebook app and host it on a page
  2. create a Wit.ai bot
  3. connect Facebook and Wit.ai
  4. customize your bot for a particular purpose

###Setup

Here are the steps to get you started with the repo.

  1. For this workshop, you will need a laptop with the following:
  • Ruby 2.x
  • A Github account

Note: We have included a .ruby-version file locked to 2.2.3, which you can change to any Ruby 2.x version if you don't have 2.2.3 installed
More detailed instructions for each platform are included in the footer. Refer there if you are having issues.

  1. Fork the repo (optional, recommended): From the page https://github.com/k00ka/fbbot, click the Fork button in the top-right corner. Copy the new repo address (in a box just below the thick red line) into your clipboard. Detailed instructions on forking a repo can be found here: https://help.github.com/articles/fork-a-repo/

  2. At Ryatta Group we use rbenv, and so we've included some optional elements - just skip them if you're using rvm or are not versioning your Ruby. If you forked the repo above, your repo_address will be in your clipboard. If not, you should use my repo_address [email protected]:k00ka/fbbot.git

% git clone <paste repo_address>
% cd fbbot
% gem install bundler
Fetching: bundler-1.7.4.gem (100%)
Successfully installed bundler-1.7.4
1 gem installed
% bundle
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Installing rake 10.3.2
...
Using bundler 1.7.4
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.

Note: if you use rbenv...

% rbenv rehash

You are (almost) there!

How to set up a conversation with your own Faecbook bot

  1. do the above
  2. create an ngrok account - http://ngrok.com
  3. download and install ngrok
  4. start ngrok
  5. sign into Facebook
  6. create a page - community - use your name and check “add to favorites”
  7. go here https://developers.facebook.com/quickstarts/?platform=web
  8. create a new app (I called my k00kabot)
  9. paste your ngrok URL into Site URL (check this)
  10. in your project space (shell) type: rackup -p 3000 (don’t hit return)
  11. back in the browser go to your app using top-right menu
  12. click dashboard
  13. click Show beside App Secret
  14. copy the app secret token to the end of your command line
  15. add Messenger on the left menu
  16. choose your new page from the page dropdown
  17. accept the warnings
  18. copy the page access to the end of your command line
  19. click setup web hooks
  20. copy ngrok HTTPS token into the callback URL
  21. set your verify token to something you’ll remember
  22. add the verify token to the end of your command line
  23. click at least the “messages” checkbox
  24. add the text “config.ru” to the end of your command line
  25. hit enter on your command line to run the bot (WEBrick starts)
  26. click verify and save on the application page (should verify)
  27. surf back to your new page
  28. click the “. . .” in the header and choose “View as page visitor”
  29. click “Message” in the header
  30. send a message - you should see “Hello, human”
  31. type ctrl-c to stop your script (don’t kill ngrok!)
  32. echo your command line into the file run1.sh (note: it’s in .gitignore, so you can't check it in with your private deets)
  33. chmod +x run1.sh
  34. CELEBRATE BRIEFLY - you have integrated with Facebook successfully - you're 1/3 of the way there

Come to the workshop to learn how to set up your AI scripts and integrate!

fbbot's People

Contributors

k00ka avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.