How fbchat-dev/fbchat works
fbchat is an unofficial Python client for using a normal Facebook account with Messenger. A developer logs in to obtain a session, then uses the client or thread objects to discover conversations, retrieve or search messages, and send messages or manage conversations. Separately, the listener consumes real-time Messenger updates and parses them into typed events. The graph retains documented capabilities such as attachments, polls, and group management; their exact internal wiring is not fully visible in the sampled excerpts.
Main entry points: _session.py Session and login · _client.py Client discovery · _abc.py Thread operations · _message.py Messages and replies
Components 17
Authentication and transport
- Session and login
fbchat/_session.py - GraphQL operations
fbchat/_graphql.py
Client and discovery
- Client discovery
fbchat/_client.py
Threads and messages
- Thread operations
fbchat/_threads/_abc.py - Group threads
fbchat/_threads/_group.py - User and page threads
fbchat/_threads/_user.py - Messages and replies
fbchat/_models/_message.py - File attachments
fbchat/_models/_file.py - Polls and plans
fbchat/_models
Real-time events
- Event listener
fbchat/_listen.py - Event dispatch
fbchat/_events/__init__.py - Delta events
fbchat/_events/_delta_class.py - Payload events
fbchat/_events/_client_payload.py - Admin events
fbchat/_events/_delta_type.py
Other components
- Python developer
- Facebook web endpoints
- Messenger MQTT
Connections 21
- Python developer → Session and login: logs in
- Python developer → Client discovery: uses
- Session and login → Facebook web endpoints: sends HTTP requests
- Client discovery → Session and login: queries session
- Client discovery → GraphQL operations: builds queries
- Client discovery → Thread operations: returns threads
- Thread operations → Session and login: sends requests
- Thread operations → GraphQL operations: builds queries
- Thread operations → Messages and replies: parses messages
- Messages and replies → File attachments: parses attachments
- Group threads → Session and login: manages membership
- Group threads → Polls and plans: parses plans
- User and page threads → Polls and plans: parses plans
- Python developer → Event listener: listens
- Event listener → Messenger MQTT: connects and subscribes
- Event listener → Event dispatch: parses updates
- Event dispatch → Delta events: dispatches deltas
- Event dispatch → Payload events: dispatches payloads
- Delta events → Admin events: parses admin deltas
- Delta events → Messages and replies: builds message events
- Payload events → Messages and replies: builds message events