slack_source() returns a dlt resource you pass straight to remember(): a thread becomes one document, the messages without replies of one UTC day become one document for that day, and later syncs render again only the threads and days that changed.
Before You Start
- Complete Quickstart to understand basic operations
- Ensure you have LLM Providers configured (
LLM_API_KEYin.env) - Read dlt Integration for how structured sources flow through
remember() - Create a Slack app at api.slack.com/apps with the bot scopes
channels:history,channels:readandusers:read(groups:historyandgroups:readfor a private channel), install it into your workspace, and copy the bot token (xoxb-...) - Invite the app to the channel (
/invite @YourApp) - Export
SLACK_BOT_TOKEN,SLACK_TEAM_ID(T...) andSLACK_CHANNEL_ID(C...)
Code in Action
What Just Happened
Step 1: Configure the Sync
remember(); pass the same ones on every later sync. write_disposition="merge" upserts documents by their id instead of replacing the synced channel on the next sync, and max_rows_per_table=0 keeps every staged row in view so forget-on-delete compares against the whole channel.
Step 2: Build the Slack Source
slack_source() reads one channel of one workspace with your bot token. The resource_name keys the staging table and the sync state, so use one per channel. If any of the three environment variables is missing, the script prints a message and returns before fetching anything; the setup steps it points to are the ones in Before You Start.
Step 3: Sync and Ask the Channel
slack_channel dataset and builds the graph. A large channel finishes its first sync over several runs: each run stops after max_requests Slack API requests (1500 by default, a slack_source() argument) or 600 seconds, and the next one resumes where it stopped. Remove the two prune calls before you run the script again: they wipe the memory earlier runs built but not dlt’s staged copy of the channel, so every document synced so far would go through graph extraction again. recall() then answers from that dataset, scoped to the channel’s node set.
Slack
Ask, save, and recall Cognee memory from Slack itself
dlt (Data Load Tool)
How dlt sources, merge syncs, and orphan cleanup work
Remember
All
remember() parameters, including the dlt optionsForget
Wipe the Slack dataset when you are done