Skip to main content

Client for Facebook Send API

Project description

FBotics: Python Client for Facebook Send API

Build Status license codecov pypi

Read the documentation at Fbotics.io.

Overview

FBotics is a Python client for Facebook Send API. The Send API is the main API used to send messages to users, including text, attachments, structured message templates, sender actions, and more. The goal of this project is to privide a clean and professional client, which can be used in production environments. For this, each new functionality added will be fully tested and documented. Currently this project is under development and offers a limited set of features of the Facebook Send API.

Getting started

First create an instance of the client with the access token of your Facebook page:

from fbotics import Client
client = Client(page_access_token="EAAHIhFHZCIQIBAAme5oAtHehYfrZCvyUZAMLABGEW8ZBmdZASYFp8wdhtbD3POKbT7m3yOnue9Y2JrYZAZBSVne0yHfdKKKfxrjL1aZB5nFCWVjBZA7BiZBNsMrVhSZCfqi4cB6CZCi2CUh41waGNlIc7gcFxAl421dqoNBUPD5ZAjxiHrAJmDRdYx8ATJRBkRqRhowMZD")

Sending a Text Message

client.send_message(recipient_id="2157136727638083", text="hello world!")

TextMessagey

Sending Quick Replies

from fbotics.models.quick_reply import QuickReply
qr1 = QuickReply({"content_type": "text",
                  "title": "Yes",
                  "payload": "payload1",
                  "image_url": "http://i64.tinypic.com/1hothh.png"})
qr2 = QuickReply({"content_type": "text",
                  "title": "No",
                  "payload": "payload2",
                  "image_url": "http://i63.tinypic.com/2pqpbth.png"})
quick_replies = [qr1, qr2]
response = client.send_message(
        recipient_id=2157136727638083,
        text="Text Message with Quick Replies",
        quick_replies=quick_replies)

QuickReply

Installation

You can install the latest version of FBotics using pip:

pip install fbotics

You can also install FBotics from GitHub source:

First, clone FBotics using git:

git clone git@github.com:pasmod/fbotics.git

Then, cd to the project folder and run the install command:

cd fbotics
pip install .

Development & Testing

Before developing FBotics further, please install Docker. For building the Docker image and installing all dependencies of FBotics, run:

cd fbotics
make build

Then execute the following command to run all the components required to work on FBotics:

cd fbotics
make up

To execute the tests:

make test

To create coverage report:

make coverage

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

fbotics-0.0.6.tar.gz (31.0 kB view hashes)

Uploaded Source

Built Distribution

fbotics-0.0.6-py3-none-any.whl (21.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page