fbapy
Unofficial Facebook Chat API for Python
Table of Contents
Introduction
fbapy is a Python version of the Node.js package @xaviabot/fca-unofficial. It is based on the forked deprecated version fca-unoffical, which itself is a fork of the deprecated version facebook-chat-api.
fbapy acknowledges the contributions of the original authors of facebook-chat-api, recognizes the efforts put into fca-unoffical, and explains that the Python version is based on the for @xaviabot/fca-unofficial.
Installation
fbapy is available on PyPI:
pip install fbapy
libmagic issue
If you encounter an error like this:
ImportError: failed to find libmagic. Check your installation
You need to install libmagic.
For Termux:
pkg install sox
For replit.com, open replit.nix and add magic to the list of dependencies, for example:
{ pkgs }: {
deps = [
pkgs.python311Packages.magic
];
}
For Other Platforms, try installing python-magic-bin:
pip install python-magic-bin==0.4.14
Example Usage
Login
Using base64 encoded appstate from c3c-fbstate
from fbapy import *
client = Client()
api = client.login(
appstate="YOUR_BASE64_ENCODED_APP_STATE",
options={
"user_agent": "YOUR_USER_AGENT",
},
)
Send Message (HTTP Method)
api.http.send_message(
msg="Hello World!",
thread_id="0000000000000000",
)
Testing
You can run test.py to test the package. Install packages from requirements.txt + python-dotenv first.
pip install -r requirements.txt
pip install python-dotenv
Then create a .env file in the root directory of the project and add the following:
APPSTATE="YOUR_BASE64_ENCODED_APP_STATE"
Then run test.py:
python test.py
Open a chat with the appstate account, try sending ?ping1/?ping2, and you should get a reply pong
Documentation
See DOCS.md for more information.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for fbapy 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fbapy-1.0.2.tar.gz | 30.6 kB | Without provenance | Details for fbapy-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fbapy-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for fbapy-1.0.2-py3-none-any.whl |
Total release size: 69.0 kB
Release files / fbapy-1.0.2.tar.gz
| Download URL | fbapy-1.0.2.tar.gz |
|---|---|
| Size | 30.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
82c1bab3e751976141c1c407c9d74ad5dfab6e70c43b36ca00fb3e7ebeafbd9a
|
|
BLAKE2b-256 checksum How to use checksums |
0bde36d2b65a423afcf613186b93c13999216570931b7c0ed42171969cc23ce2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / fbapy-1.0.2-py3-none-any.whl
| Download URL | fbapy-1.0.2-py3-none-any.whl |
|---|---|
| Size | 38.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1e6979e187ab26db33e32f544c96daaa5aa0e047bb67e3d1e4c66a93cfbf2dbf
|
|
BLAKE2b-256 checksum How to use checksums |
54eb72f11dbf44469de78a2b30d4a6b13edc1eeaa0dc0c2d1fdae62b5ca67aee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Security for fbapy 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.