Python/Django Wrapper for Facebook Messenger Bot Platform.
Project description
FBBOTW: A Facebook Bot Wrapper
Python Wrapper for Facebook Messenger Bot Platform.
This bot makes it simpler to user the Facebook messenger bot platform wrapping the endpoints as functions.
fbid = "<user fb id>"
message = "Hello World"
url = 'https://graph.facebook.com/v2.6/me/messages?access_token='
url += PAGE_ACCESS_TOKEN
header = {"Content-Type": "application/json"}
payload = {}
payload['recipient'] = {'id': fbid}
payload['message'] = {'text': message} # Limit 320 chars
data = json.dumps(payload)
status = requests.post(url, headers=header, data=data)
Using fbbotw you would easily write
from fbbotw import fbbotw
# ...
fbid = "<user fb id>"
message = "Hello World"
fbbotw.post_text_message(fbid, message)
Install
pip install fbbotw
Using with Django
#settings.py
PAGE_ACCESS_TOKEN = "<your access token>"
or create environment variable with the same name:
export PAGE_ACCESS_TOKEN='<your access token>'
2 - To use the functions of this wrapper do:
from fbbotw import fbbotw
fbbotw.typing(fbid, "typing_on")
If you want to use this package without Django
Download the .zip of this directory.
Copy the fbbotw directory to your project root.
Define a variable called PAGE_ACCESS_TOKEN as the page access token you got from facebook
Import the package in your module.
from fbbotw import fbbotw
fbbotw.typing(fbid, "typing_on")
Documentation
Current wrapper covering for the Menssenger Platform (78%)
[x] User profile
[ ] Send API
[x] Content Types
[x] Text messages
[x] Audio attachment
[x] File attachment
[x] Image attachment
[x] Video attachment
[x] Quick Replies
[x] Sender Actions
[ ] Templates
[x] Button Template
[x] Generic Template
[x] List Template
[x] Receipt Template
[ ] Airline Boarding Pass Template
[ ] Airline Checkin Template
[ ] Airline Itinerary Template
[ ] Airline Flight Update Template
[x] Buttons: Check documentation to format your buttons in your templates
[x] Call Button
[ ] Thread Settings
[x] Greeting Text
[x] Persistent Menu
[ ] Payment Settings (BETA)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for fbbotw-1.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3bda6a701fd111b845487ae1ff22fdeb0a28a1b595ac38d763ce1f27f3a4701 |
|
MD5 | 67d26a644ea55e563f77e4223c962cb5 |
|
BLAKE2b-256 | 6c57a1799493c55acfe1840a50fbd519e50b7540cf0874f39140941c2f356d8f |