TenantConfig reference
the KV-backed config shape that drives a tenant's bot, forms, connectors, and theme.
TenantConfig
everything a tenant needs, keyed by tenantId (default "self") in KV under tenant:<id>.
for "self", botToken/chatId come from Worker secrets and the rest from KV; any
other tenant reads the whole thing from KV.
getTenant() only treats a config as usable once both botToken and chatId are
present; a partial config (e.g. a prompt saved before creds) still round-trips through KV.
FormSpec
Connector
telegram + email are delivered server-side; whatsapp + instagram are CTA links only.
see lead forms + connectors.
WidgetTheme
only these fields are exposed to the public GET /api/widget/config; the projection is a
literal whitelist (never a spread of the config), so botToken/chatId/systemPrompt are
structurally excluded. see security.
KV keys
| key | value |
|---|---|
tenant:<id> | the TenantConfig JSON blob |
session:<tenant>:<sessionId> | the Telegram thread id for that session |
thread:<tenant>:<threadId> | the session id for that thread |
usage:<tenant>:<yyyymm>:<kind> | monthly usage counter โ kind โ ai | handoff | tokens |
entitlement:<tenant> | optional billing snapshot (unused in self-host) |