Skip to content

Getting Started

hundredeir edited this page Jun 23, 2017 · 2 revisions

Welcome to the Facebook_PyBot wiki!

Getting Started

First of all you have to create an App and a page on Facebook platform.For which Facebook provides a good guide. https://developers.facebook.com/docs/messenger-platform/guides/setup

Before you validate your webhook; you have to setup one. This wrapper is using Falcon which you can deploy on server of your choice, guide for a few of them are given in the link below http://flask.pocoo.org/docs/0.12/deploying/

To get started

create a new script and write :

import os
import Facebook

then create a new Verify Token; It can be alphanumeric. And store it in a variable named.

Token="user generated token"

Now, you should use the function in example script echo and pass it in below function Now, we have to setup our webserver. This can be done by using http function from webhook. Which will return a wsgi callable app.

PORT = int(os.environ.get('PORT', '5000'))
app = webhook.http(main, verify_token)

This app can be called from any wsgi server.

As an example, we can use gunicorn which is a python WSGI HTTP server.

pip install gunicorn   #install the module first
gunicorn name_of_bot_file:app   #Then run the app from terminal

One method which uses cherrypy is given in the echo in examples folder

After the verification is done, You can create your script to run bots.

Clone this wiki locally