Skip to main content

vital-chatwoot-bridge

Chatwoot management bridge with REST API and async Python client.

What It Does

  • REST Management API — CRUD endpoints for Chatwoot contacts, conversations, messages, agents, and inboxes, secured with Keycloak JWT
  • Unified Messaging — Single POST /messages endpoint for inbound and outbound messages across SMS, email, and iMessage (via LoopMessage)
  • Webhook Bridge — Routes Chatwoot webhook events to AI agents via WebSocket (AIMP protocol)
  • API Inbox Integrations — LoopMessage (bidirectional iMessage) and Attentive (inbound aggregation)

Client Library

Install with client dependencies only (no server deps):

pip install vital-chatwoot-bridge[client]

Usage

from vital_chatwoot_bridge.client.client import ChatwootBridgeClient

async with ChatwootBridgeClient(
    base_url="https://bridge.example.com",
    keycloak_url="https://keycloak.example.com",
    realm="myrealm",
    client_id="my-client",
    client_secret="secret",
) as client:
    # Contacts
    contacts = await client.list_contacts(page=1)
    contact = await client.create_contact(name="Jane Doe", email="jane@example.com")

    # Conversations
    convs = await client.list_conversations(status="open")
    summary = await client.account_summary()

    # Messages
    result = await client.post_message(
        direction="outbound",
        contact_identifier="jane@example.com",
        message_content="Hello from the bridge!",
        inbox_id=1,
    )

    # Force a new conversation instead of reusing an open one
    result = await client.post_message(
        direction="outbound",
        contact_identifier="+15551234567",
        message_content="New thread",
        inbox_id=6,
        conversation_mode="create_new",
    )

Exception Handling

from vital_chatwoot_bridge.client.exceptions import (
    BridgeClientError,
    AuthenticationError,
    NotFoundError,
    ValidationError,
    ServerError,
)

try:
    contact = await client.get_contact(999999)
except NotFoundError:
    print("Contact not found")
except AuthenticationError:
    print("Token expired or invalid")

Response Models

from vital_chatwoot_bridge.client.models import PaginatedResponse, SingleResponse

All list endpoints return PaginatedResponse (with .data, .meta).
All single-item endpoints return SingleResponse (with .data).

Server Deployment

See aws_deploy/README.md for ECS Fargate deployment.

Local Development

# Start with Docker Compose
docker compose up --build

# Run endpoint tests
python -m test_endpoint_scripts.test_contacts
python -m test_endpoint_scripts.test_conversations
python -m test_endpoint_scripts.test_messages --case m-send-lm -v

# List all test case IDs
python -m test_endpoint_scripts.test_messages --list

Configuration

All configuration via environment variables. Hierarchical config (inbox mappings, API integrations) uses CW_BRIDGE__ prefix with __ separator. See env.example.

Architecture

vital_chatwoot_bridge/
  api/
    routes.py                    # Health endpoint
    api_inbox_routes.py          # LoopMessage / Attentive inbound/outbound
    chatwoot_management_routes.py  # Management REST API (36 endpoints)
  chatwoot/
    api_client.py                # Chatwoot API client (httpx, retries)
    management_models.py         # Pydantic request/response models
  client/                        # Standalone client library
    client.py                    # ChatwootBridgeClient (async)
    auth.py                      # Keycloak JWT token management
    base.py                      # HTTP client with error mapping
    models.py                    # Response envelope models
    exceptions.py                # Typed exception hierarchy
  core/
    config.py                    # CW_BRIDGE__ env parser integration
  utils/
    env_parser.py                # Generic hierarchical env var parser
    jwt_verify.py                # Keycloak JWT verification (server-side)
    logging_config.py            # JSON / text log formatting
  handlers/
    webhook_handler.py           # Chatwoot webhook → AI agent routing

Metadata

Release files for vital-chatwoot-bridge 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vital-chatwoot-bridge 0.1.4
File Size Uploaded Provenance
vital_chatwoot_bridge-0.1.4.tar.gz 120.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for vital-chatwoot-bridge 0.1.4
File Interpreter ABI Platform
vital_chatwoot_bridge-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 264.9 kB

Release files / vital_chatwoot_bridge-0.1.4.tar.gz

Download URL vital_chatwoot_bridge-0.1.4.tar.gz
Size 120.2 kB
Tags Source
SHA-256 checksum
How to use checksums
959c42299c4d29187f8edc53e51caa75ffdf259145d07f3f2318e5ddc796c5b9
BLAKE2b-256 checksum
How to use checksums
abd5d4a9a96a30525b4a573d75c714b53d129c10ff02d7cb35ad5077dbff0887
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release files / vital_chatwoot_bridge-0.1.4-py3-none-any.whl

Download URL vital_chatwoot_bridge-0.1.4-py3-none-any.whl
Size 144.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c17307c5eb7c7c8cc0fdf4806188f0562a9cded3ba1936afe080538fae3665f
BLAKE2b-256 checksum
How to use checksums
4e8ddcd1b46f1016703de14e8e9e76e2169044a7bda8055790df5c0b9b9c71b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Security for vital-chatwoot-bridge 0.1.4

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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