Skip to main content
Connect Slack to Cognee so your team can query and grow the knowledge graph without leaving a channel or DM. Cognee ships more than one way to reach Slack. Pick the one that matches what you run:
The built-in app, the standalone bot, and the cloud connector are three separate Slack apps (different manifest, different scopes, different transport) — do not point one at another’s server.

Built-in Slack App

The Slack app that ships inside the cognee package, served by your own self-hosted backend. Members talk to it by mentioning @cognee in a channel the app is in, or in a direct message to the app. The person who connected the workspace picks which channels are synced into memory; @cognee <question> answers from those channels with a numbered Sources line linking back to the Slack messages it read. Requires cognee >= 1.6.8. Earlier releases shipped a different app built on slash commands (/cognee-ask, /cognee-remember, /cognee-link, /cognee-import), a Remember entire thread shortcut and the /api/v1/slack/history/* endpoints. All of these were removed in 1.6.8. To upgrade an app created from the old manifest, recreate it from the manifest below, then disconnect and reconnect the workspace (see Reconnecting after a manifest change).

Why Use This Integration

  • Ask from anywhere in Slack: @cognee <question> answers in the thread, citing the Slack conversations it read. Ask in a DM to keep the question private.
  • Synced channels, not one-off imports: selected channels are synced into one dataset per workspace, and synced again every 6 hours. Edits, deletions and deselected channels are reflected in memory.
  • Save what Slack never saw: @cognee remember <text> stores a note, such as a decision from a call.
  • Save or retract a message: the Remember this and Forget this message shortcuts store a message in your own memory or take it back out.
  • Per-user, not per-workspace: each member links their own Cognee account once with @cognee link (Sign in with Slack), so their questions and saves use their own memory.
  • Self-hosted, no middleman: your Slack app talks directly to your Cognee backend. No data passes through a third-party relay.
One Slack app is installed once per workspace, but memory is per-person. A member who has not linked their account is refused rather than attributed to someone else, and is told to send @cognee link first. The only unlinked member Cognee acts for is the Slack user who installed the app.

Prerequisites

  • Cognee >= 1.6.8 or a dev checkout.
  • A running Cognee backend and frontend reachable over HTTPS from the public internet. Slack calls the events URL, the interactivity URL and both OAuth redirect URLs, and it will not call localhost. For local development use a tunnel (below). In production, use your deployment’s public domain.
  • The browser must use the same host to start the install and for the OAuth callback. The callback checks a cookie that was set when the install started, and a cookie belongs to one host. On another host the install ends in error_invalid_state.
  • A Cognee account for each Slack member who wants to link their own memory.

Local Development: ngrok Tunnel

Tunnel the UI on port 3000, not the API. The UI forwards /api/v1 to the API, including Slack’s signed requests, so the UI, the API and the OAuth callbacks all share one public host. That host is what every <public-host> placeholder below refers to. Skip this section if your deployment already has a public domain.
  1. Install ngrok: brew install ngrok on macOS, or download the binary from ngrok.com/download.
  2. Authenticate once: sign up for a free account, copy your authtoken from the dashboard, and run ngrok config add-authtoken <token>.
  3. Start the UI with the API proxy, then the tunnel:
If you start the UI with cognee-cli -ui, put COGNEE_DEV_API_PROXY=http://localhost:8000 in .env instead. The CLI starts the UI with that environment.
  1. Open the UI at https://<public-host>. Do not use localhost:3000, which cognee-cli -ui opens by itself. Connecting from there ends in error_invalid_state, which the UI reports as an expired authorization link, so check the address bar first.
Leave ngrok running the whole time you’re testing. Closing it kills the tunnel and every request URL stops resolving.
A free plan’s random host changes on every restart, which means re-editing the Slack app’s URLs and .env each time. A free account includes one reserved domain that fixes this permanently: create it under Domains in the ngrok dashboard, then run ngrok http 3000 --domain=your-name.ngrok-free.app.
Free-tier ngrok shows a “Visit Site” interstitial page to browsers opening the tunnel URL directly. It does not apply to Slack’s server-to-server requests (events, interactivity), so it never blocks the integration itself.

Setup

1. Create the Slack App from the Manifest

Create a separate Slack app per environment (local dev, staging, production) and per developer. Never point the production app’s manifest at your laptop. If you reuse one app, events meant for someone else’s server are routed to your tunnel.
  1. Go to api.slack.com/apps → Create New App → From an app manifest.
  2. Paste the manifest below. Replace every <public-host> with your public host and, for a real deployment, change the app name and bot name.
  3. On the app’s Basic Information page, copy Client ID, Client Secret, and Signing Secret. You need them for .env in step 2.
Slack tries to verify the events URL as soon as the manifest is saved. That first check fails until the server is running with the signing secret set (step 2). This is expected. Retry the verification afterwards on the app’s Event Subscriptions page.
The same manifest ships in the repository as scripts/slack-app-manifest.sdk.yml, with a local-testing app name and <ngrok> as the host placeholder. Only the callback_ids are matched server-side (remember_this, forget_this). The shortcut names are yours to choose. There are no slash commands. The commands scope is still needed because the message shortcuts require it. The bot scopes must match the list above exactly. The server requests a fixed set of scopes when a workspace connects, so adding more to the manifest does nothing. message.channels and message.groups send every message of every channel the app is in to your server. The server acts only on deletions and edits (so a synced thread or a saved copy is updated) and acknowledges the rest.
Reconnecting after a manifest change. Slack never grants new scopes to an existing Cognee connection retroactively. A workspace connected before app_mentions:read, chat:write, im:history or users:read were in the manifest must be disconnected and reconnected: call DELETE /api/v1/integrations/slack/connection, then connect again (step 1 of Connect, Pick Channels, Link). Without users:read, the channel sync stops before reading anything and reports failed_missing_scope. After editing the manifest, also reinstall the app and reload the Slack client (Cmd+R).
Granting the scopes does not start a sync. Nothing is read until someone selects channels. See Syncing Channels below.

2. Configure Cognee

Copy the app’s credentials into your backend’s .env: Then bring the stack up from source:
Run the API with one worker. A sync’s lock and its run exclusivity are per process, so two workers could sync one workspace at once. The default entrypoint.sh uses -w 1. Restart the backend after any .env change, then retry the Request URL verification on the app’s Event Subscriptions page.
The self-hosted Cognee UI has no Slack connect screen, so you connect the workspace and pick channels through the API. Cognee Cloud runs its own Slack app with a connect screen in the UI; see Slack in Cognee Cloud.
  1. Log in to the Cognee UI on https://<public-host>, then open https://<public-host>/api/v1/integrations/slack/start in the same browser. It sets the install cookie and redirects to Slack’s consent page. Approving it runs the OAuth exchange and stores the workspace’s bot token. POST /api/v1/integrations/slack/authorize returns the same Slack URL as JSON, but it sets the cookie on its own response, so call it from that browser, not from a terminal.
  2. Invite the app to each channel you want synced (/invite @cognee). This includes public channels.
  3. Pick the channels with GET and then PUT /api/v1/integrations/slack/resources (see Syncing Channels). A new connection selects nothing, and nothing syncs until channels are picked.
  4. Each member sends @cognee link and opens the page it replies with, in a browser where they are logged in to Cognee (see Linking a member).
  5. Try @cognee What does Cognee do? in a synced channel.
Start the install from Cognee (/start or authorize), not from Slack’s “Install to Workspace” button. The OAuth state and the install cookie are what bind the install to a Cognee account. Slack’s own install button sends neither, so the callback rejects it and you land on /integrations?slack=error_invalid_state.

Using It

Mention @cognee in a channel the app is in, or send it a direct message: An answer is a regular message. Every other reply is ephemeral, shown only to the member who asked. A DM is always allowed. In a channel the channel allowlist applies, except to forget, unlink and status. There are no slash commands. A message that starts with @cognee (or another app’s mention), meaning a question or a command, is never synced into memory as channel content, and neither are DMs to the app. A message that mentions @cognee later in its text is still answered, and is synced as ordinary content.

What an Answer Reads

  • In a channel, the answer is visible to everyone there, so it reads only what all of them can: the workspace’s dataset limited to that channel (when it is synced) and the selected public channels. It never reads another selected private channel or the asker’s other datasets. In a Slack Connect channel, for a guest asking, or when Slack cannot say which channels are public, it reads that channel alone.
  • In a DM, it reads the selected channels the member is in, plus the member’s other datasets whole.
  • A channel answer searches the channels’ messages only (RAG_COMPLETION, a chunk search). The hybrid entity lane is not used, because one entity is one node for every channel that names it and could carry a relation from a channel outside the scope.
  • The search runs as the asker’s linked Cognee account, so the synced channels are read only when that account has read access to the workspace dataset (slack_account_<hash>). For a member linked to another account, share the dataset with it first. Otherwise a channel answer reads nothing and replies “Nothing to read here”.
The answer is rendered as Slack mrkdwn. Below each fact, a numbered Sources line links to the Slack messages it read, as #channel · author · date. A final line says what the answer read, such as From #channel and N public channels, or From your channels and your memory in a DM. Rating. Each answer carries 👍 and 👎 buttons. Only the member who asked can rate it. A rating is stored as session feedback (5 or 1) and moves the feedback weight of the workspace-dataset graph elements the answer used. @cognee answers do not read these weights: they use a chunk search (RAG_COMPLETION), which ignores feedback. The weights affect graph-completion searches of the workspace dataset, for example through the API or SDK, and only once DEFAULT_FEEDBACK_INFLUENCE is above 0 (default 0.0). With CACHING=false the answer is posted without the buttons.

Linking a Member

@cognee link replies with a link to GET /api/v1/integrations/slack_member/start. Logged in to Cognee in that browser, the member is sent to Sign in with Slack. Slack proves which member signed in, and a nonce cookie proves it is the browser that started it, so nothing typed into or forwarded through Slack can link an account. Only the openid scope is requested, and Slack’s user token is not kept. A client of your own can call POST /api/v1/integrations/slack_member/authorize and follow the returned URL instead. DELETE /api/v1/integrations/slack_member/connection unlinks the member.

Restricting Where Cognee Can Be Used

An opt-in, per-workspace channel allowlist decides where @cognee and the shortcuts work. It never decides what is synced; that is the channel selection’s job. It is set through two authenticated endpoints:
  • GET /api/v1/slack/channels lists every public channel, plus the private channels the app is in that the person who connected the workspace is also in. Each entry is flagged with whether it is allowed.
  • PUT /api/v1/slack/channels sets the list (channelIds). An empty list (the default) means unrestricted. An id the listing does not offer returns 422 and nothing is saved.
When Slack rate-limits the channel list, both endpoints answer 429 with Slack’s Retry-After. Once a non-empty allowlist exists, @cognee in other channels is refused, so remember this when testing from a scratch channel. GET/PUT /api/v1/slack/settings holds one owner-only setting, forgetUnavailableChannels (default false). See the channel table below.

Syncing Channels

The channel sync goes through the generic integration routes: All channels of a workspace go into one dataset, slack_account_<hash of the team id>. Besides manual syncs, an in-process tick syncs every connection with a selection every 6 hours, and resumes after 10 minutes when a run was cut short by its request budget, a rate limit or a Slack outage. A large channel can take several runs to finish its first sync. SLACK_HISTORY_SYNC_ENABLED=false turns the tick off. One workspace runs one sync at a time. How conversations are stored. A thread (a message with replies) is one document. The messages without replies of one UTC day in one channel are one document for that day. Authors and mentions are rendered by full name, Slack markup is decoded, and attached files are named but never downloaded. Each document carries the node set slack:channel:<channel_id> (plus slack:shared for a Slack Connect channel). The channel name is kept as the document’s parent, so renaming a channel re-cognifies nothing. Joins, leaves and other non-content messages, the app’s own messages, and messages that talk to an app are left out. DMs and group DMs are not synced. Edits and deletions. A sync renders again only the threads and days that changed. An edited or deleted message is picked up from the app’s message events and its thread is read again on the next sync. A deleted reply, or a deleted message without replies, is removed the next time its thread or day is read. A thread that is gone from Slack is forgotten only once a sync completes a walk of the whole channel. Forget this or @cognee forget on a message of a synced channel, by its author or by the person who connected the workspace, leaves that message out of every later sync. The message stays in Slack. Before reading a channel, the sync asks Slack about it:
The workspace dataset is the access boundary. Its owner is the person who connected the workspace, and anyone with read access to that dataset can read every synced channel through search. Slack channel membership is not copied into Cognee ACLs, and node sets do not enforce permissions. @cognee itself scopes each answer as described in What an Answer Reads.
Documents written by the former history importer (/cognee-import, before 1.6.8) stay in the datasets they were imported into and are no longer updated.

Syncing a Channel from Code

The same connector is available in the SDK as slack_source, for a bot token you already hold. One source is one channel. The bot token needs channels:history, channels:read and users:read (plus groups:history and groups:read for a private channel), and the app must be a member of the channel.
Run the same call again to sync. Filter by channel id, not name: node_name=["general"] finds nothing. A runnable script is in examples/guides/slack.py.
The same source also ships as its own package, cognee-connector-slack. Import it with from cognee_connector_slack import slack_source. It takes the same arguments, and you pass it the same remember() keyword arguments shown above. The package does not install Cognee: install cognee 1.6.6 or later next to it to call remember(). The cognee extra (cognee>=1.6.8,<2) is only for the package’s server-side Slack app adapter. Every current Cognee still bundles its own copy of that app, so set it up as described above; the package README covers wiring the package’s copy into a server. The package supports Python 3.10 to 3.14. To install it from the cognee repository:
The package registers the source under the cognee.sources entry point as slack, which hosts read with cognee_connectors_core.registry.load_sources(). The cognee package does not load it on its own.

Search References

A search with include_references=True names each Slack document it read by its title and permalink (document_title, document_url) and its channel name (document_parent), which is how @cognee builds its Sources line.

Uninstalling, Disconnecting, and Removing the App from a Channel

  • Removing the app from a channel stops it from reading or answering there. A selected channel it was removed from is handled as in the channel table above.
  • Uninstalling the app (app_uninstalled) revokes the connection and, as Slack’s Developer Policy asks, deletes the workspace’s data 14 days later: the synced documents, the dlt staging copy and state, and every member’s Remember this and @cognee remember items from that workspace. Connecting the workspace again within the 14 days cancels the deletion. Slack delivers events best effort, so an app_uninstalled that never arrives starts no deletion.
  • tokens_revoked alone or a disconnect deletes nothing, unless the disconnect is called with delete_data=true.
  • After the connection ends, GET /api/v1/integrations/slack/connection reports connected: false with disconnectedBy ("provider" for an uninstall or a bot token revoked in Slack, "owner" for a disconnect in Cognee, even when Slack echoes it back as tokens_revoked), disconnectedAt, and the datasetId the synced data stays in. After an uninstall, dataDeletedAfter says when the data will be deleted and dataDeletedAt is set once it was.

Multiple Environments

Slack apps are tied to one set of OAuth credentials and their redirect URLs. If you run more than one Cognee deployment (local dev, staging, production), create a separate Slack app per environment rather than editing one app’s config back and forth. Each environment gets its own SLACK_CLIENT_ID/SLACK_CLIENT_SECRET/SLACK_SIGNING_SECRET/SLACK_REDIRECT_URI/SLACK_MEMBER_REDIRECT_URI.
This is separate from how many Slack workspaces one deployment can serve: any number of teams can each connect their own workspace to the same Cognee deployment through the same Connect flow. Each workspace syncs into its own dataset.

Troubleshooting

  1. Connect ends in ?slack=error_invalid_state: the UI and the OAuth callback are on different hosts, usually a tunnel while the UI is open on localhost:3000. Open the UI on the tunnel host (see the ngrok section), or you used Slack’s own “Install to Workspace” button instead of starting from /api/v1/integrations/slack/start.
  2. “Something went wrong when authorizing Cognee” during Connect: the redirect URI your backend sent (SLACK_REDIRECT_URI, or SLACK_MEMBER_REDIRECT_URI for @cognee link) isn’t byte-identical to an entry under the app’s redirect URLs, or .env holds a different app’s SLACK_CLIENT_ID/SLACK_CLIENT_SECRET.
  3. Callback redirects to ?slack=error_exchange_failed: the traceback is in the backend log. Usual causes: a redirect URI mismatch, or a missing/malformed INTEGRATION_CREDENTIALS_KEYS.
  4. Slack’s events URL verification fails: the server is not reachable through the tunnel yet, or SLACK_SIGNING_SECRET is not set. Start the server with the secret set, then retry the verification on the Event Subscriptions page.
  5. Signature verification fails on every request (401): SLACK_SIGNING_SECRET doesn’t match the app you installed. Copy it again from Basic Information and restart the backend.
  6. @cognee does nothing: the app is not in the channel (/invite @cognee), or the workspace was connected with an older manifest and lacks app_mentions:read / chat:write. Disconnect and reconnect it.
  7. “Link your Slack account first”: the member has not linked their Cognee account. Send @cognee link and open the page in a browser where you’re logged in to Cognee.
  8. An answer says nothing was found in a channel: the channel is not synced and there is no selected public channel. Add the channel with PUT /api/v1/integrations/slack/resources and wait for the sync, or check @cognee status.
  9. The sync reports failed_missing_scope: the token lacks users:read. Disconnect and reconnect the workspace.
  10. Request URL mismatch after restarting ngrok: free-tier ngrok mints a new random host every restart. Update every URL in the app’s settings and .env, or use a reserved domain.

Standalone Channel-Memory Bot

cognee-integration-slack is a separate Slack bot from the cognee-integrations repository. Instead of one synced dataset per workspace, it gives a workspace per-channel memory: once a channel opts in, the bot silently ingests its messages into that channel’s own Cognee dataset, and anyone can ask @cognee <question> or /recall <question> to get an answer with cited links back to the source Slack messages. It is a thin client to a running Cognee server over HTTP (POST /api/v1/add, /cognify, /search, /forget) — no in-process Cognee and no LLM key of its own, since the server holds those. Slack I/O runs over Socket Mode, so it needs no public URL, no tunnel, and none of the manifest or OAuth setup above.

Install

The package is not published on PyPI yet. Install it from the repository:
Requires Python 3.10+. The only runtime dependencies are slack-bolt, aiohttp, and httpx. uv sync creates a project venv without activating it, so run the bot through uv run (below) or activate .venv first; pip install -e . into an already active environment needs neither.

Create the Slack App

In api.slack.com/apps, create an app with Socket Mode enabled, then:
  1. Copy the bot token (xoxb-…) and the app-level app token (xapp-…).
  2. Subscribe the bot to the message.channels and app_mention events.
  3. Add the slash commands /recall, /cognee-optin, /cognee-optout, and /cognee-forget.
  4. Install the app to the workspace and invite the bot to the channels it should remember.

Configure and Run

The bot reads everything from environment variables (a .env.example ships in the package directory):
Opt-in state lives in the bot’s process memory. /cognee-optin and /cognee-optout mutate a set that starts from COGNEE_SLACK_OPTED_IN_CHANNELS and is never written back anywhere. After a restart, only the channels listed in that variable are remembered — put every channel that should stay opted in there, or opt them in again.

Commands

An empty question gets a usage hint back. A channel with no dataset yet — never opted in, or opted in with nothing cognified — returns “I couldn’t find anything about that in this channel’s memory yet.”: the server answers the search with a 404 for the unknown dataset, which the bot treats as an empty result. Once the channel has memory, an unanswerable question gets whatever the LLM produces from the available context; the bot does not filter refusal phrasings. A server-side failure (LLM auth, rate limit, a failed cognify) returns “Sorry — I hit an error answering that.” rather than silence; the cause is in the bot’s logs.

How It Works

  • One dataset per channel. Messages land in the dataset slack_<channel_id>, tagged with a node set of [<channel_id>]. The dataset is the boundary /cognee-forget clears, so forgetting is per channel, never per person.
  • Batched graph building. Each message is added with a cheap add call; cognify runs once a channel has COGNEE_SLACK_COGNIFY_BATCH pending messages, and always before answering a question, so an answer reflects everything said so far. Concurrent cognify runs on one channel are serialized.
  • Cited answers. Answering runs two searches: GRAPH_COMPLETION for the prose, and CHUNKS filtered to the channel’s node set for the source messages. Each stored message carries a one-line provenance header ([cognee-slack] channel=… ts=… author=… permalink=…) inside its text, which is parsed back out of the retrieved chunks to build the links. The reply is a Block Kit message: the answer, then up to five sources as links labelled #<channel ID> · <user ID> · <UTC time> (raw Slack IDs, not names — the link itself opens the original message) with a +N more note for the rest. A message whose permalink could not be resolved shows as plain text, never a broken link.
  • What gets ingested. Messages and thread replies in opted-in channels. Edits, deletions, joins, bot messages, the bot’s own posts, messages that mention the bot, and empty messages are skipped. Public channels only, via message.channels. Edited or deleted Slack messages are not re-synced.

Tests

The suite runs without Slack, Cognee, or LLM credentials — the adapter runs against a fake HTTP client, the handlers against mocks:

Channel-Memory Bot Source

Source and tests for cognee-integration-slack.

dlt Integration

Load other sources through dlt the same way slack_source does.

Cloud Integrations UI

Where “Connect Slack” lives in the Cognee Cloud UI.

Node Sets

How per-channel node-set tags scope retrieval.