Skip to content

a facebook messenger bot that allows users to chat with other people on facebook anonymously

License

Notifications You must be signed in to change notification settings

mayukh18/BlindChat

Repository files navigation

BlindChat

A Facebook messenger bot that allows users to chat with other people on Facebook anonymously.

You can find it livehere.

NOTE: The app and the project is not maintained anymore. PRs will be unattended.

A bit of a background

I started out building BlindChat just to try out the messenger platform of Facebook and to try to build something usable out of it while learning in the process. It is more of an app rather than an AI chatbot. The outcome got a bit of traction and hence I improved certain parts of it, however, most of the code may be in an unorganized condition since those are built for quick prototyping.

Local development / Setup your version of the app

BlindChat is currently hosted onHerokuand uses their offered database. Thus, the code and setup are written for it. If you don't want to use Heroku, you'll have to modify the code in a few places but if you are okay with Heroku, then you are just fine. It helps to have a bit of knowledge setting up a messenger bot.

  1. Clone the repository by opening up your terminal/cmd and running the following command to set up your local repository:

    git clone https://github /mayukh18/BlindChat.git/
    
  2. Create a messenger app on Facebook. Add and configure the webhook and be certain to note down both theAccess TokenandVerify Token.

  3. Install theHeroku CLI toolbeltif you don't already have it. Then create an app on Heroku by opening up your terminal/cmd and running the following command:

    heroku create yourappname
    
  4. Run the following command to install the required libraries to your local environment:

    pip install -r requirements.txt
    
  5. Run the following command to set up a Postgres database with Heroku:

    heroku addons:add heroku-postgresql:hobby-dev
    
  1. Next run the following lines:
    heroku run Python
    >> import os
    >> os.environ.get('DATABASE_URL')
    
  • The URL returned from running the above commands is yourSQLALCHEMY_DATABASE_URI.
  1. Open theconfig.pyfile and replace'YOUR_FACEBOOK_APP_ACCESS_TOKEN'and'FACEBOOK_APP_VERIFY_TOKEN'with the respective tokens from Step 2, replace'APP_URL'with your Heroku app URLhttps://yourappname.herokuapp /and finally, replace'YOUR_DATABASE_URI'with your database URI from step 6..

  2. Next, to set up and migrate the models into your database, run

    Python manage.py db init
    Python manage.py db migrate
    Python manage.py db upgrade
    
  3. Lastly, deploy to Heroku with the following command, and Voila!

    git push heroku master
    

Note:

  • You may findthis memohelpful if you run into problems while setting this up.
  • Youmayneed to install PostgreSQL on your system if you run into some issues in the above step. Checkthison the official guide.

Directory structure

  • DB_Wrappers: Contains the wrapper classes for the models in the database.
  • modules: Contains all the functionalities from starting a chat session to sending a message.
  • templates: Contains different message templates and webviews.

Contributing

All contributions are welcome. Please discuss your ideas on the community first to avoid clash of others working on the same thing. A few issues are marked as "beginner friendly" which are suitable for beginners to try out.

Ask in Issues if you are not sure on something. Cheers!