Metadata-Version: 2.4
Name: fca-unofficial
Version: 0.0.1
Summary: fca-unofficial: Unofficial Facebook Chat API for Python
Author: Adnan Sami Bhuiyan
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.31.0
Requires-Dist: paho-mqtt>=1.6.1
Requires-Dist: websocket-client>=1.7.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: black>=24.0.0; extra == "dev"
Requires-Dist: ruff>=0.5.0; extra == "dev"

# python-facebookapi

python-facebookapi: Unofficial Facebook Messenger API (Python) developed by Adnan Sami Bhuiyan.

Status: Experimental WIP. Supports cookie-based login (appState) and basic HTTP wrappers. MQTT realtime and full endpoint parity are in progress.

## Install (editable)

- Local development: use pip in editable mode from this folder.

## Quickstart

```python
from python_facebookapi import login

api = login({"appState": [
    {"key": "c_user", "value": "123456789"},
    {"key": "xs", "value": "..."},
    # other cookies
]})

print("Logged in as:", api.get_current_user_id())
status, res = api.httpGet("https://www.facebook.com/")
print(status)
```

## MQTT realtime (preview)

```python
from python_facebookapi import login

api = login({"appState": [
    {"key": "c_user", "value": "123456789"},
    {"key": "xs", "value": "..."},
]})

def on_event(err, event):
    if err:
        print("MQTT error:", err)
        return
    print("event:", event)

listener = api.listenMqtt(on_event)

# Send a message via MQTT
api.sendMessageMqtt("Hello MQTT", threadID="<THREAD_ID>")

# React to a message
api.setMessageReactionMqtt("<MESSAGE_ID>", "🙂", threadID="<THREAD_ID>")

# Typing indicator
api.sendTypingIndicatorV2("<THREAD_ID>", True)

# Admin actions
api.nickname("Cool Guy", "<THREAD_ID>", participantID="<USER_ID>")
api.gcname("New Group Name", "<THREAD_ID>")
api.gcmember("add", ["<USER_ID>"], "<THREAD_ID>")
api.gcrule("admin", "<USER_ID>", "<THREAD_ID>")
api.pinMessage("pin", "<THREAD_ID>", "<MESSAGE_ID>")

# Stop listener when done
listener.stop()
```

Dependencies for realtime: paho-mqtt, websocket-client (declared in pyproject).

## Run tests (optional)

If you have pytest installed in your environment:

```bash
pytest -q
```

## Notes
- Use valid cookies (appState). Email/password login is intentionally not implemented.
- For proxies, pass options={"proxy": "http://host:port"}.
- Headers are randomized with realistic UA strings.
