I thought it would be great to interact with self-hosted AI via a messaging platform like Signal, so I built this async Python client for sending and receiving messages. It wraps [bbernhard's signal-cli-rest-api](https://github.com/bbernhard/signal-cli-rest-api), which does the heavy lifting of talking to the Signal protocol.
> [!NOTE] Get the Package
> Install from PyPI: [signal-cli-rest-api-client](https://pypi.org/project/signal-cli-rest-api-client/)
## What It Covers
The upstream API exposes around 40 endpoints. This client wraps the ones you actually need for messaging:
- **Sending and receiving**: Send messages (with attachments, quotes, edits, styled text) and stream incoming events over WebSocket.
- **Reactions and typing indicators**: Set/clear emoji reactions, show/hide typing status, send read receipts.
- **Attachments**: Upload, download, list, and delete.
- **Rate-limit recovery**: Submit CAPTCHA challenges when Signal throttles you.
Everything is async (built on aiohttp) and fully typed. Requires Python 3.10+.
## Quick Start
```python
import asyncio
from signal_cli_rest_api_client import SignalClient
client = SignalClient(url="https://signal.example.com", phone="+12345678901")
async def main():
await client.send("+10987654321", "Hello from Python")
async for event in client.stream_events():
print(event)
asyncio.run(main())
```
The API instance needs to be running in `json-rpc` mode for the v2 send endpoint and WebSocket streaming to work.
## Links
- [PyPI](https://pypi.org/project/signal-cli-rest-api-client/)
- [signal-cli-rest-api](https://github.com/bbernhard/signal-cli-rest-api) (the upstream project this client wraps)
PRs welcome if you need endpoints beyond what's currently covered.