CortexDB Docs
Connectors

Discord Connector

Ingest Discord channel messages into CortexDB.

Tails Discord channel messages and writes them to CortexDB as conversation experiences.

Two ways to run this connector

Self-hosted — pip install 'cortexdb-connectors[discord]' then cortexdb-sync sync discord. Managed — CortexDB runs the connector as a worker. See the Connectors overview.

1. Prepare credentials

Discord Developer Portal → New Application → Bot → copy the bot token. Enable the Message Content Intent, and invite the bot to your server with Read Messages / View Channels + Read Message History permissions.

What gets written

Each message becomes a POST /v1/experience on the resolved scope (default org:<org>/source:discord/team:{guild}/project:{channel}), author resolved to a username, body as content.

Record keys and threads

  • The idempotency_key is discord:<message_id> (not a dc:<guild>:<channel>:<message_id> composite).
  • Thread replies attach a thread=… label, not context.preceded_by.

The key on the wire is derived

The key format above is this connector's internal record identity: it decides which source record an event belongs to. The idempotency_key actually sent to CortexDB is a derived cxsrc:<56 hex> value that also hashes the content, labels, observed time and actor, so an unchanged redelivery converges on the same event while any edit lands as a new one, even where the key format itself is not content-versioned. Every event also carries a source descriptor with the record's fingerprint. See Source identity and keys.

Run it yourself

pip install 'cortexdb-connectors[discord]'
pip install cortexdb-cli && cortexdb init

export DISCORD_BOT_TOKEN=...              # required

cortexdb-sync --api-url http://localhost:3141 sync discord
cortexdb-sync --api-url http://localhost:3141 watch discord --interval 60

Optional settings

Set these as environment variables (or the matching keys in the cortexdb-sync YAML config). Lists are comma-separated. For on/off settings, 1, true, yes or on turns the setting on and any other value turns it off.

SettingWhat it doesDefault
DISCORD_CHANNELSChannel IDs to sync (takes precedence over guilds)None
DISCORD_GUILDSGuild (server) IDs; their text channels are syncedNone

Set DISCORD_CHANNELS or DISCORD_GUILDS: with neither, there is nothing to sync.

See also

On this page