Skip to main content

Python/Django Wrapper for Facebook Messenger Bot Platform.

Project description

FBBOTW: A Facebook Messenger Platform API Wrapper

Build Status Documentation Status PyPI MIT licensed

This wrapper makes it simpler to user the Facebook Messenger platform wrapping the endpoints as functions.

For exemple, to send a text message to the user you can easily do:

from fbbotw import fbbotw
# ...

user_fbid = "<user fb id>"
my_message = "Hello World"

fbbotw.post_text_message(fbid=user_fbid, message=my_message)
# The user with the specified fbid will receive the text 'Hello World'

This is much less code than the traditional way to call the Send API and send a text. Using requests and json you probably would do like this:

  fbid = "<user psid>"
  message = "Hello World"
  url = '{0}'
  url = url.format(PAGE_ACCESS_TOKEN)
  header = {"Content-Type": "application/json"}
  payload = {}
  payload['recipient'] = {'id': fbid}
  payload['message'] = {'text': message}
  data = json.dumps(payload)
  response =, headers=header, data=data)

Learn more about the fbbotw methods by reading the DOCS

Get Started

1- Install

pip install fbbotw

2 - Configure it

The only configuration needed is to set the PAGE_ACCESS_TOKEN with the value you got from the facebook app dashboard. If you are using Django, create the variable in your If not, define the variable in your enviroment:

2.1 - Django

1 - In your define the variable PAGE_ACCESS_TOKEN that was generated on the app configuration from facebook.
PAGE_ACCESS_TOKEN = "<your access token>"

2.2 - Not Django

Create an os environment variable called PAGE_ACCESS_TOKEN:

export PAGE_ACCESS_TOKEN='<your access token>'

3 - Import and Use it

After setting the access token, just import and use fbbotw methods:

from fbbotw import fbbotw

fbbotw.post_sender_action(fbid="<user psid>", sender_action="typing_on")

See the documentation to learn about the methods provided by the package.


Current wrapper covering for the Menssenger Platform 2.0

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for fbbotw, version 2.2.1
Filename, size File type Python version Upload date Hashes
Filename, size fbbotw-2.2.1-py2.py3-none-any.whl (13.5 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size fbbotw-2.2.1.tar.gz (17.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page