Skip to content

Chat Bridge

The Chat Bridge connects Nova to external messaging platforms like Telegram and Slack. It runs as a single service with pluggable platform adapters that auto-enable based on which bot tokens are configured.

PropertyValue
Port8090
FrameworkFastAPI
State storeRedis (db 4)
Sourcechat-bridge/
Profilebridges (opt-in)
  • Platform adapters — connect to messaging platforms via their native APIs (polling or webhooks)
  • Session mapping — map platform-specific chat IDs to Nova agent sessions, persisted in Redis with a 7-day TTL
  • Orchestrator streaming — send user messages to the Orchestrator’s streaming endpoint and collect the full response
  • Auto-enable — adapters activate automatically when their required tokens are present in the environment
PlatformStatusRequired config
TelegramImplementedTELEGRAM_BOT_TOKEN
SlackPlannedSLACK_BOT_TOKEN, SLACK_APP_TOKEN

The chat-bridge runs under a Docker Compose profile and does not start by default:

Terminal window
docker compose --profile bridges up -d

To include it alongside the full stack:

Terminal window
docker compose --profile bridges up -d --build
MethodPathDescription
GET/health/liveLiveness probe
GET/health/readyReadiness probe (checks Orchestrator connectivity and adapter status)
GET/api/statusReports which adapters are configured
POST/webhook/telegramTelegram webhook receiver (only registered when webhook mode is active)
VariableDescriptionDefault
ORCHESTRATOR_URLURL of the Orchestrator servicehttp://orchestrator:8000
REDIS_URLRedis connection stringredis://redis:6379/4
NOVA_API_KEYAPI key for authenticating with the Orchestrator(empty)
DEFAULT_AGENT_NAMEDisplay name for bridge-created agentsNova
DEFAULT_MODELModel to use for bridge sessionsauto
TELEGRAM_BOT_TOKENTelegram Bot API token from BotFather(empty)
TELEGRAM_WEBHOOK_URLPublic URL for webhook mode; omit to use polling(empty)
SLACK_BOT_TOKENSlack bot token (Phase 2)(empty)
SLACK_APP_TOKENSlack app-level token (Phase 2)(empty)
SERVICE_PORTPort to listen on8090
LOG_LEVELLogging levelINFO
REQUIRE_AUTHWhether to require auth for API callstrue

Each platform adapter implements the PlatformAdapter base class:

class PlatformAdapter(ABC):
platform_name: str # e.g. "telegram"
def is_configured() -> bool # check if required tokens are set
async def setup(app) # register routes or start polling
async def shutdown() # clean up connections

At startup, the bridge iterates over all registered adapters. Any adapter whose is_configured() returns True gets activated. Adapters with missing tokens are silently skipped, so a single deployment can serve multiple platforms by simply adding tokens to the environment.

  1. Message @BotFather on Telegram and create a new bot with /newbot
  2. Copy the bot token and add it to your .env:
    TELEGRAM_BOT_TOKEN=123456:ABC-DEF...
  3. Start the bridge: docker compose --profile bridges up -d

By default the Telegram adapter uses long polling — it connects outbound to the Telegram API and pulls updates. This works behind NAT and firewalls with no additional setup.

For production with a public URL, set TELEGRAM_WEBHOOK_URL to enable webhook mode. The bridge registers a POST endpoint at /webhook/telegram and tells Telegram to push updates there:

TELEGRAM_WEBHOOK_URL=https://your-domain.com
CommandDescription
/startWelcome message with available commands
/newStart a fresh conversation (resets the session)
/statusCheck connection status

Any other text message is forwarded to Nova as a chat message. Responses are returned with Markdown formatting when supported.

Sessions are stored in Redis db 4 with the key pattern:

nova:bridge:{platform}:{platform_id}

For example, a Telegram chat with ID 12345 maps to nova:bridge:telegram:12345. Each key stores a JSON object with session_id and agent_id, and expires after 7 days of inactivity. The /new command deletes the key, forcing a fresh agent on the next message.

  • Fault-tolerant — adapter startup failures are caught and logged; other adapters continue to run
  • Streaming collection — the bridge consumes the Orchestrator’s SSE stream and collects the full response before replying (messaging platforms expect complete messages)
  • Markdown fallback — Telegram replies attempt Markdown formatting first, falling back to plain text if parsing fails
  • Typing indicators — the Telegram adapter sends a typing action while waiting for the Orchestrator response