Skip to main content
Yanked

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 httpx for non-blocking I/O
  • Typed models — IncomingMessage and SendResult are 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 httpx and pydantic
  • Extensible — Subclass BaseAdapter to 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)

Source distribution for async-social-bridge 0.1.0
File Size Uploaded Provenance
async_social_bridge-0.1.0.tar.gz 12.7 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for async-social-bridge 0.1.0
File Interpreter ABI Platform
async_social_bridge-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 24.2 kB

Release files / async_social_bridge-0.1.0.tar.gz

Download URL async_social_bridge-0.1.0.tar.gz
Size 12.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a641af3e4ac506e14b0214398d4e8751aea0ef94ac94343e8bcfe36e1330c00b
BLAKE2b-256 checksum
How to use checksums
7dba72432cfc5b62022c7bfd8e3a3451a3f69e736bdbee38d706df97f1b18592
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

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 log

Release files / async_social_bridge-0.1.0-py3-none-any.whl

Download URL async_social_bridge-0.1.0-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e655315deee47eeafa72173bd13006af917ca8b418d566fff882fb06be360b2d
BLAKE2b-256 checksum
How to use checksums
b53fd52b9b5ca5f83f0d76194a819998792f650f93e8875fff013eb0e08f666a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

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 log

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.

Select from 2 files

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 log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page