Direct omnichannel chat SDK for Python — Telegram, Slack, Google Chat, Teams, WhatsApp. No server needed — install, connect your channels, handle messages.
Project description
OmniChat
Omnichannel chat SDK for Python. Connect Telegram, Slack, Google Chat, Microsoft Teams, and WhatsApp with a single package — no server deployment needed.
Install
pip install omnichat
Usage
import asyncio
from omnichat import OmniChatBot
async def main():
sdk = OmniChatBot()
sdk.use_telegram("your-bot-token")
# sdk.use_slack("xoxb-bot-token", "xapp-app-token")
# sdk.use_gchat(service_account_key="/path/to/service-account.json")
# sdk.use_teams("your-app-id", "your-app-password")
async def on_message(thread, msg):
print(f"[{msg.platform}] {msg.author.user_name}: {msg.text}")
await thread.reply(f"You said: {msg.text}")
async def on_mention(thread, msg):
await thread.reply(f"Hey {msg.author.user_name}! You mentioned me.")
sdk.on_message(on_message)
sdk.on_mention(on_mention)
await sdk.start()
asyncio.run(main())
Live-updating replies (tracked messages)
For streaming AI output, don't wait for the full response before showing anything — send once, then rewrite that same message in place as more text arrives:
handle = await thread.reply_tracked("Thinking") # appears immediately
await thread.update_reply(handle, "Thinking about it...") # rewrites the same message
await thread.update_reply(handle, "Here's the full answer.")
This avoids a chat platform showing "not responding" during long generations, and avoids leaving a stray "Thinking..." message behind — there's only ever one message, and it's rewritten as it grows.
Support varies by platform:
| Platform | reply_tracked() |
update_reply() |
|---|---|---|
| Google Chat | ✅ | ✅ — PATCH messages.update |
| Slack | ✅ | ✅ — chat.update |
| Telegram | ✅ | ✅ — editMessageText |
| Microsoft Teams | ✅ | ✅ — Bot Framework activity update |
| ✅ (returns a real message id) | ❌ raises NotImplementedError — the Cloud API has no endpoint to edit a sent message |
Supported Platforms
| Platform | Method | How it works |
|---|---|---|
| Telegram | use_telegram(bot_token) |
Long polling — no public URL needed |
| Slack | use_slack(bot_token, app_token) |
Socket Mode — no public URL needed |
| Google Chat | use_gchat(service_account_key, port, path, upload_as_user) |
HTTP webhook + service-account app auth |
| Microsoft Teams | use_teams(app_id, app_password) |
HTTP webhook + Azure OAuth2 |
use_whatsapp(access_token, phone_number_id, verify_token, port, path) |
HTTP webhook + Graph API |
Credentials
| Platform | What you need | Where to get it |
|---|---|---|
| Telegram | Bot Token | Talk to @BotFather on Telegram |
| Slack | Bot Token + App Token | api.slack.com — enable Socket Mode |
| Google Chat | Service account JSON key (+ HTTPS endpoint registered in the Chat API config) | console.cloud.google.com — enable the Chat API, configure the app, create a service account |
| Microsoft Teams | App ID + App Password | portal.azure.com — Register a Bot |
| Access Token + Phone Number ID + Verify Token | developers.facebook.com — create a Meta Business App with WhatsApp integration |
Google Chat file attachments (send_file()) additionally need upload_as_user set to a Workspace user your service account has domain-wide delegation for — the Chat API's attachment upload endpoint only accepts user authentication, not the app (service-account) authentication used for text messages.
Requirements
- Python >= 3.10
- No server deployment needed
- No database needed
Testing
The SDK includes unit tests for core logic (history, state, fluent chaining, etc.):
pytest tests/
Note: Network-level tests for real platform integrations are not included. To verify platform integration, deploy the package and test against real platform APIs (Telegram Bot API, Slack Web API, Google Chat API, etc.) with valid credentials and a public URL tunnel (ngrok, Cloudflare tunnel, etc.).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file omnichat-1.0.0.tar.gz.
File metadata
- Download URL: omnichat-1.0.0.tar.gz
- Upload date:
- Size: 19.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85a68a6bf53b8bf9483d4a860146448c7c492e514517892a72d9aef36b7b7c7f
|
|
| MD5 |
d0a833dccb0dac57efcfbb5620b1786f
|
|
| BLAKE2b-256 |
0bded10bda200ae48e6b5f0db96f7cba77e0cce1d8a2580917f0f89053c78aa0
|
File details
Details for the file omnichat-1.0.0-py3-none-any.whl.
File metadata
- Download URL: omnichat-1.0.0-py3-none-any.whl
- Upload date:
- Size: 25.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0afdcd770b7369461d70db9523a4855048111d302dba24184daf122c0f4b6838
|
|
| MD5 |
ee2c6d7157bede38315d0c734718caed
|
|
| BLAKE2b-256 |
c918ce1cbc6c3450eb7461d66c1873d5bfa6b815967103f365a2f921ed4e0457
|