This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.1.1 instead.
async-social-bridge
Async messaging adapters for Meta platforms (WhatsApp, Messenger, Instagram).
Send and parse messages with a clean, typed Python API. Zero bloat — only httpx and pydantic as dependencies.
Installation
pip install async-social-bridge
Quick Start
Parse incoming webhooks
from chatbridge.meta import parse_webhook
# In your FastAPI / Flask webhook handler:
payload = await request.json()
messages = parse_webhook(payload)
for msg in messages:
print(f"[{msg.platform}] {msg.sender_name or msg.sender_id}: {msg.text}")
Send messages
from chatbridge.meta import WhatsAppAdapter, MessengerAdapter
# WhatsApp
async with WhatsAppAdapter(access_token="your_token") as wa:
result = await wa.send_text(
receiver_id="your_phone_number_id",
to="recipient_phone",
text="Hello from chatbridge!"
)
print(result.success) # True
print(result.message_id) # "wamid.xxx..."
# Messenger
async with MessengerAdapter(access_token="your_token") as fb:
result = await fb.send_text(
receiver_id="your_page_id",
to="recipient_psid",
text="Hello from chatbridge!"
)
Features
- Async-first — Built on
httpxfor non-blocking I/O - Typed models —
IncomingMessageandSendResultare Pydantic models with full type hints - Webhook parsing — One function to normalize WhatsApp, Messenger, and Instagram payloads
- Context manager — Proper HTTP client lifecycle with
async with - Minimal dependencies — Only
httpxandpydantic - Extensible — Subclass
BaseAdapterto add Telegram, Slack, or any other platform
Models
IncomingMessage
| Field | Type | Description |
|---|---|---|
platform |
str |
"whatsapp", "messenger", or "instagram" |
sender_id |
str |
Platform-specific sender identifier |
receiver_id |
str |
Page ID, phone number ID, etc. |
text |
str |
Message text content |
timestamp |
datetime |
When the message was received |
metadata |
dict |
Contains extra info (e.g., sender_name) |
raw |
dict | None |
Original webhook JSON for advanced use |
SendResult
| Field | Type | Description |
|---|---|---|
success |
bool |
Whether the send succeeded |
error |
str | None |
Error message if failed |
status_code |
int | None |
HTTP status code |
metadata |
dict |
Contains platform response (e.g. message_id) |
raw_response |
dict | None |
Raw JSON response |
Extending
Create your own adapter by subclassing BaseAdapter:
from chatbridge.base import BaseAdapter
from chatbridge.models import SendResult
class TelegramAdapter(BaseAdapter):
def __init__(self, bot_token: str):
super().__init__(
access_token=bot_token,
base_url="https://api.telegram.org",
)
async def send_text(self, receiver_id: str, to: str, text: str) -> SendResult:
resp = await self._client.post(
f"/bot{self.access_token}/sendMessage",
json={"chat_id": to, "text": text},
)
data = resp.json()
return SendResult(
success=data.get("ok", False),
message_id=str(data.get("result", {}).get("message_id")),
status_code=resp.status_code,
raw_response=data,
)
License
MIT
Metadata
Release files for async-social-bridge 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| async_social_bridge-0.1.0.tar.gz | 12.7 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| async_social_bridge-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.2 kB
Security for async-social-bridge 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for async_social_bridge-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.