Skip to content

harriscw/heroku_facebook_bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

heroku_facebook_bot

This was an exercise in creating a basic facebook chat bot. It has now been taken offline.

Building a facebook bot

How this facebook bot works (ngrok)

  • A bit more involved than the twitter bot
  • One major difference: you have to host your facebook bot on a webserver so there can be a continuous back and forth of information
  • How to get the bot going:
    • Python code is built using Flask - a web framework for Python code
    • Create an app on the facebook developer site and set up client/access keys/secrets in code and on facebook
    • Use ngrok to create a temporary URL for you to host your app from your machine
    • Set up a webhook on facebook using this URL for secure back and forth communication between facebook messenger and your webserver
  • One thing that confused me: only people you give admin priviledges to your bot on facebook can chat with it unless you submit your bot to facebook for an official review

How this facebook bot works (heroku)

  • hosting bots via ngrok is bad
    1. need to constantly run both ngrok and your code on your machine to keep your bot to be alive
    2. if you want to update your bot you need to
      • stop running your python code
      • stop ngrok
      • update python code
      • start running your python code
      • start ngrok
      • update facebook webhook with new ngrok URL
  • Solution: heroku
    • Online service that will create a url for you to host stuff
    • set up is relatively easy
    • Main advantage: you can just push updates to your python code to GitHub and they will automatically be deployed to your bot

Main Takeaways

  • Its pretty easy to get a basic bot up and running
  • Don't need to be super strong in Python, mainly copy and paste
  • These bots are very basic but tons of room for creativity

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages