Automatically ingest Slack messages into CortexDB as episodes.
Slack Connector
The Slack connector continuously ingests messages from your Slack workspace into CortexDB. Messages are stored as message episodes with channel, author, and thread metadata.
Setup
1. Create a Slack App
- Go to api.slack.com/apps
- Create a new app from scratch
- Add the following Bot Token Scopes:
channels:history-- Read messages from public channelschannels:read-- View channel infogroups:history-- Read messages from private channels (optional)users:read-- View user info
- Install the app to your workspace
- Copy the Bot User OAuth Token (
xoxb-...)
2. Configure the Connector
# Environment variables
CORTEX_SLACK_TOKEN=xoxb-your-bot-token
CORTEX_SLACK_CHANNELS=#engineering,#product,#incidents
CORTEX_SLACK_TENANT_ID=my-app
CORTEX_SLACK_NAMESPACE=slack
3. Start the Connector
# As part of CortexDB
docker run -d \
-e CORTEX_SLACK_TOKEN=xoxb-... \
-e CORTEX_SLACK_CHANNELS="#engineering,#product" \
-e CORTEX_SLACK_TENANT_ID=my-app \
cortexdb/cortexdb:latest \
--enable-connector slack
# As a standalone process
cortexdb-connector slack \
--token xoxb-... \
--channels "#engineering,#product" \
--tenant-id my-app
What Gets Ingested
| Slack Event | Episode Type | Content |
|---|---|---|
| Channel message | message | Message text |
| Thread reply | message | Reply text (with thread metadata) |
| File share | document | File description + extracted text |
| Bot message | Skipped | Bot messages are ignored by default |
Episode Metadata
Each ingested message includes:
{
"type": "message",
"content": "We should migrate the payments service to CockroachDB.",
"source": "slack",
"author": "alice",
"channel": "#engineering",
"timestamp": "2026-03-15T10:30:00Z",
"metadata": {
"slack_ts": "1710502200.000100",
"thread_ts": "1710502100.000050",
"reaction_count": 3,
"reply_count": 5,
"workspace": "acme-corp"
}
}
Configuration
| Variable | Default | Description |
|---|---|---|
| CORTEX_SLACK_TOKEN | Required | Slack bot token |
| CORTEX_SLACK_CHANNELS | All public | Comma-separated channels |
| CORTEX_SLACK_TENANT_ID | Required | Target tenant |
| CORTEX_SLACK_NAMESPACE | slack | Target namespace |
| CORTEX_SLACK_INCLUDE_BOTS | false | Include bot messages |
| CORTEX_SLACK_INCLUDE_THREADS | true | Include thread replies |
| CORTEX_SLACK_BACKFILL_DAYS | 30 | Days of history to backfill on first run |
| CORTEX_SLACK_POLL_INTERVAL_SEC | 10 | Polling interval |
Backfill
On first run, the connector backfills the configured number of days of history. Subsequent runs process only new messages using Slack's cursor-based pagination.
# Backfill 90 days of history
cortexdb-connector slack --backfill-days 90