fca-python is a high-performance, asynchronous, and modular Python SDK for Facebook Messenger. Engineered for speed and reliability, it provides 100% feature parity with the popular Node.js FCA implementation while leveraging Python's modern asyncio ecosystem.
- ⚡ Extreme Performance: Built on
httpxandpaho-mqttfor non-blocking I/O. - 🧩 Modular Architecture: Cleanly separated into Core, HTTP, GraphQL, and MQTT layers.
- 📡 Real-time Synchronization: Native MQTT support for instant message listening and high-speed actions.
- 🛠️ Feature Rich: 70+ functions covering messaging, group management, stories, and polls.
- 🛡️ Privacy First: Secure session handling and automated privacy scrubbing.
Install the SDK via pip:
pip install fca-pythonThe SDK provides a simplified facade for instant productivity.
import asyncio
from fca import login
async def main():
# Authenticate via Email/Password or AppState (Recommended)
api = await login(email="your_email", password="your_password")
# Send a simple message
await api["sendMessage"]({"body": "Hello from fca-python!"}, "THREAD_ID")
if __name__ == "__main__":
asyncio.run(main())For real-time applications, use the integrated MQTT listener:
async def on_message(event):
if event.get("type") == "message":
print(f"📩 New message: {event['body']}")
await api["listenMqtt"](on_message)| Category | Supported Features |
|---|---|
| Messaging | sendMessage, editMessage, unsendMessage, setMessageReaction, forwardAttachment |
| Groups | createNewGroup, changeGroupImage, addUserToGroup, removeUserFromGroup, changeAdminStatus |
| User Profile | getUserInfo, getUID, changeName, changeBio, changeUsername, setProfileLock |
| Social | createPoll, createPost, setStoryReaction, handleFriendRequest, createNote |
| Maintenance | getThreadList, deleteThread, muteThread, markAsSeen, getThreadHistory |
The SDK is organized into logical layers to ensure maximum extensibility:
- Core: Authentication, session management, and API factory.
- HTTP: Native Facebook web endpoint implementations.
- GraphQL: High-level data queries using the Facebook GQL engine.
- MQTT: Event-driven WebSocket client for real-time interaction.
This project is licensed under the MIT License.
Important
This is a port of the Node.js FCA project. This software is provided as-is, without any warranty or guarantee of maintenance. The author is not responsible for any illegal usage. Use responsibly and comply with Meta's Terms of Service.
Built for the Python community.