# Inbox engine

> The Chatwork inbox runs on the chatwork engine. How the bridge talks to it, and the version policy.

URL: https://chatwork.io/en/docs/inbox-engine
Section: Platform

The Chatwork inbox is the only conversation store, and its engine is chatwork, self-hosted on your server. The rest of this page uses the engine's own name, because that is what you install, configure and upgrade. The bridge talks to it in exactly two ways: the REST application API (with the admin token, or the tenant's agent-bot token) and the agent-bot webhook. It never touches chatwork's database.

## Version policy

The image is pinned (`chatwoot/chatwoot:v4.19.1`) in `infra/docker-compose.yml`. An upgrade is a separate change: back up, pull the new tag, start Rails and Sidekiq, check `/api`, then run the platform gate. Nothing else moves in that change. The platform `VERSION` does not change when chatwork does; the version matrix in the [changelog](/en/docs/changelog) records both.

## Accounts and inboxes

- Outside production, and for the platform's own tenant, the shared `CHATWOOT_ACCOUNT_ID` is used.
- In production every other tenant gets its own chatwork account through the Platform API (`CHATWOOT_PLATFORM_TOKEN`), with the bridge's admin user added as an administrator.
- A tenant's match set is its own `(account, inbox)` pair plus every routable connection inbox. No two tenants may hold the same pair; the store refuses it and routing quarantines it.

## The agent bot

One agent bot per account, `outgoing_url = {DOT_PUBLIC_BASE_URL}/webhooks/chatwoot?token=<CHATWOOT_WEBHOOK_SECRET>`. On a tenant's own account the bot token is stored Fernet-encrypted on the tenant record, so replies render as the bot; without it the admin token is used and the echo is recognised by a short-lived marker.

## Native channels

WhatsApp Cloud, Telegram and Email are native chatwork inboxes created through the API (`POST /api/v1/accounts/{account}/inboxes`) with the bot attached; Instagram and Facebook are connected in chatwork's UI and then registered with the bridge. chatwork delivers to the provider and reports delivery state. Running a custom connector for a channel chatwork already supports is forbidden by design.
