Cortex Agents for Slack

Introduction

Snowflake for Slack brings Cortex Agents into your workspace so teams can ask questions in natural language and get answers from Snowflake data without leaving Slack.

  • CoWork — Query structured data through pre-built Cortex Agents. Get tables, charts, and narrative answers in direct messages and channels.
  • CoCo (Cortex Code) — Run deeper, multi-step analysis with AI-powered investigation, SQL exploration, and generated reports.

For the per-user setup, each person signs in as their own Snowflake user, and requests run as that user, including that user’s masking and row access policies. An administrator can limit the primary role and the secondary roles those requests use. See Limit the roles Slack can use. In a multiplayer channel, requests instead run as the channel’s bound service user. For more information, see multiplayer channels in Cortex Agents for Slack.

Important

When you use this integration, you are directing Snowflake to send or receive data between the Snowflake Service and Slack. Snowflake is not responsible for the privacy, security, or integrity of data once it leaves the Snowflake Service boundary. Your use of Slack, and any data you process with it, is governed solely by the terms between you and Slack.

AI-generated content

AI can make mistakes. CoWork and CoCo are powered by large language models (LLMs). AI-generated responses — including text, SQL, tables, charts, and generated reports — may be inaccurate, incomplete, inappropriate, or biased. Review and verify outputs before relying on them, and apply human oversight to any decisions based on them.

For more information, see the Legal notices at the bottom of this page.

Install

Before you install, make sure that you have the following:

  • A Snowflake account that is enabled for this preview. To request access, contact your Snowflake account team.
  • A role with the CREATE INTEGRATION privilege. The ACCOUNTADMIN role has this privilege by default.
  • Permission to add apps to your Slack workspace. If your workspace restricts app installation, a Slack workspace administrator must approve the request before the app is available.
  • A default Cortex Code (CoCo) settings agent configured for the account. Before you change account-level settings for the Slack integration, create the CORTEX_CODE.CONFIG.DEFAULT agent. For instructions, see Configure default model settings.

Important

Snowsight is the only supported way to install the app. The Snowsight flow is what links your Slack workspace to your Snowflake account, so don’t start the installation from Slack. If you install the app from Slack, it isn’t connected to your Snowflake account.

To install the app from Snowsight, do the following:

  1. Sign in to Snowsight.
  2. Select Settings » Account » Agent settings » Integrations.
  3. On the Snowflake AI for Slack tile, select Connect to Slack Workspace. Slack opens an authorization window.
  4. In the authorization window, confirm the Slack workspace that is selected in the dropdown at the upper right, then select Allow.

Important

If you belong to more than one Slack workspace, the authorization window might preselect a workspace other than the one you want. Check the workspace in the dropdown before you select Allow. If you authorize the wrong workspace, repeat the installation and select the correct workspace.

After you install

The integration owner grants the USAGE privilege on the integration to each role that needs access to the app:

GRANT USAGE ON INTEGRATION SNOWFLAKE_SLACK_APP TO ROLE <role_name>;

Until a user’s role has this privilege, that user can’t use the app from Slack.

Each user then does the following:

  1. Open a direct message with Snowflake in Slack.
  2. Select Authenticate with Snowflake and sign in to your Snowflake account.
  3. Ask a question in plain language, or @mention the app in a channel to ask a question there.

Limit the roles Slack can use

A direct message or a personal @mention runs as the Snowflake user who authenticated. The session’s primary role is that user’s default role. Secondary roles follow that user’s default secondary roles (DEFAULT_SECONDARY_ROLES).

A multiplayer channel runs only as the bound role, with secondary roles disabled.

You can limit the primary role, and you can choose how secondary roles are set, on the SNOWFLAKE_SLACK_APP security integration. Store the limits in ACCESS_CONFIGURATION. This control isn’t enabled for all accounts yet. On an account where it isn’t enabled, Snowflake rejects ACCESS_CONFIGURATION. To request access, contact your Snowflake account team.

Secondary roles

Set USE_SECONDARY_ROLES inside ACCESS_CONFIGURATION to one of these values:

  • NONE: the Slack session has no secondary roles. The request can use only the privileges of the primary role.
  • IMPLICIT: secondary roles follow the user’s DEFAULT_SECONDARY_ROLES.

ALL isn’t valid on the integration. To activate every role granted to the user, leave USE_SECONDARY_ROLES unset and set the account parameter instead:

ALTER ACCOUNT SET SLACK_INGRESS_SECONDARY_ROLE_MODE = 'ALL';

SLACK_INGRESS_SECONDARY_ROLE_MODE accepts NONE, IMPLICIT, and ALL. Its default is IMPLICIT. Snowflake uses it when USE_SECONDARY_ROLES isn’t set on the integration. When USE_SECONDARY_ROLES is set, that value overrides the account parameter.

A multiplayer channel keeps secondary roles disabled. USE_SECONDARY_ROLES applies to direct messages and personal @mentions.

To run personal Slack sessions with no secondary roles:

ALTER SECURITY INTEGRATION SNOWFLAKE_SLACK_APP
  SET ACCESS_CONFIGURATION = (USE_SECONDARY_ROLES = 'NONE');

To follow each user’s default secondary roles:

ALTER SECURITY INTEGRATION SNOWFLAKE_SLACK_APP
  SET ACCESS_CONFIGURATION = (USE_SECONDARY_ROLES = 'IMPLICIT');

Primary role

ALLOWED_PRIMARY_ROLES is the list of primary roles Slack may use. Each name must be an existing role. An unknown name fails the statement.

Slack uses the user’s default primary role. In a multiplayer channel, Slack uses the bound role. A role in ALLOWED_PRIMARY_ROLES is used only when it is that default role or that bound role. If the default role or the bound role is outside the list:

  • A direct message or personal @mention is refused. Slack tells the user that their Snowflake role doesn’t have access to this Slack integration. The same message appears when the role is missing USAGE on the integration.
  • A multiplayer channel whose bound role is outside the list can’t answer.

The role that runs the request still needs USAGE on SNOWFLAKE_SLACK_APP.

Omit ALLOWED_PRIMARY_ROLES, or set it to an empty list, to leave the primary role unrestricted.

ALTER SECURITY INTEGRATION SNOWFLAKE_SLACK_APP
  SET ACCESS_CONFIGURATION = (ALLOWED_PRIMARY_ROLES = ('ANALYST'));

Replace ANALYST with a role that exists in your account. You can list more than one role. Setting ALLOWED_PRIMARY_ROLES keeps a USE_SECONDARY_ROLES value that’s already stored. To set both in one statement:

ALTER SECURITY INTEGRATION SNOWFLAKE_SLACK_APP
  SET ACCESS_CONFIGURATION = (
    USE_SECONDARY_ROLES = 'NONE',
    ALLOWED_PRIMARY_ROLES = ('ANALYST')
  );

To clear only the primary-role list:

ALTER SECURITY INTEGRATION SNOWFLAKE_SLACK_APP
  SET ACCESS_CONFIGURATION = (ALLOWED_PRIMARY_ROLES = ());

To remove ACCESS_CONFIGURATION and return secondary roles to SLACK_INGRESS_SECONDARY_ROLE_MODE:

ALTER SECURITY INTEGRATION SNOWFLAKE_SLACK_APP UNSET ACCESS_CONFIGURATION;

DESC SECURITY INTEGRATION SNOWFLAKE_SLACK_APP shows the stored ACCESS_CONFIGURATION.

How it works in Slack

The following sections describe the main workflows after installation, with screenshots for each.

Ask CoCo in a direct message

Ask questions in a DM to run CoCo (Cortex Code) for deeper analysis, including charts and multi-step reasoning over your Snowflake data.

Each message that you send in the DM starts its own conversation. To continue a line of questioning, reply in the thread that the app creates under your message rather than sending a new message in the DM.

Because CoCo can run tools on your behalf, it asks for your approval before it takes an action such as running a shell command. Approve the individual action, or choose to allow that tool for the rest of the session.

Snowflake app in a Slack direct message answering a CoCo question with a chart and narrative response.

Use CoWork in a channel

@mention the app in a channel or thread to run CoWork Cortex Agents against your Snowflake data.

The answer is visible only to you, so an @mention in a busy channel doesn’t post results to everyone. To make an answer visible to the channel, select Share in thread. You can also select the option to continue the conversation in a DM with the app, which moves your follow-up questions out of the channel.

Snowflake app responding to an @mention in a Slack channel with a CoWork agent answer.

Manage settings

To open settings, send a DM to the app, then select the overflow menu (…) on any of its answers and select Settings. In settings, you can choose your default run mode (CoCo or CoWork), manage connected Snowflake accounts, and adjust preferences.

Snowflake settings modal in Slack for choosing run mode and connected Snowflake account.

Multiplayer channels

An administrator can bind a Slack channel to a Snowflake service user and a CoCo agent, so that every member of the channel can @mention the app without being a Snowflake user in your account. For more information, see multiplayer channels in Cortex Agents for Slack.

Slack activity in your account

Every request that the app sends to Cortex Agents records where in Slack it came from. Use these records to tie monitoring data and conversation threads back to a Slack workspace, channel, thread, and user. The records contain Slack IDs, not message text.

Slack metadata in monitoring events

Each agent request from Slack writes a CORTEX_AGENT_REQUEST event to SNOWFLAKE.LOCAL.AI_OBSERVABILITY_EVENTS. The event’s VALUE column holds the Slack details as a JSON string under the snow.ai.observability.client_metadata key. The following query reads them:

SELECT timestamp,
       record_attributes:"ai.observability.record_id"::STRING AS request_id,
       record_attributes:"snow.ai.observability.agent.thread_id"::NUMBER AS thread_id,
       PARSE_JSON(value:"snow.ai.observability.client_metadata"::STRING):slack_bot AS slack
  FROM SNOWFLAKE.LOCAL.AI_OBSERVABILITY_EVENTS
  WHERE timestamp > DATEADD(day, -1, CURRENT_TIMESTAMP())
    AND record:name::STRING = 'CORTEX_AGENT_REQUEST'
    AND value:"snow.ai.observability.client_metadata"::STRING ILIKE '%"slack_bot"%';

The querying role needs access to the event table. For the access model, see AI_OBSERVABILITY_EVENTS table and Query Cortex Agent logs with SQL.

The slack_bot object has the following fields:

FieldDescription
conversation.team_idID of the Slack workspace.
conversation.channel_idID of the Slack conversation that the answer belongs to: a DM, a channel, or a private channel.
conversation.thread_tsTimestamp of the Slack thread that the answer belongs to.
conversation.channel_typeSlack’s channel type for the triggering message (im, channel, group, or mpim). Omitted when Slack doesn’t send one, for example for an @mention.
trigger.sourceWhat started the request: event for a Slack message or @mention, interaction_resume when a button click resumes a request (for example an approval), or dm_task for a background task in a DM.
trigger.event_typeSlack event type of the triggering message: message or app_mention.
trigger.message_tsTimestamp of the Slack message that started the request.
trigger.actor.user_idID of the Slack user who sent that message.
execution.run_kindWhere the request ran: dm_tool or dm for a DM, mention for an @mention in a channel, tag for a multiplayer channel, or dm_worker for a background task started from a DM.
execution.continuationnone, or interaction_resume when the request continues after an approval or other interaction.

One Slack message can lead to several agent requests, for example when CoCo calls a tool and then answers. Each of those requests writes its own event, and every event carries the same Slack metadata.

Direct message:

{"slack_bot": {
  "conversation": {"team_id": "T0123ABCD", "channel_id": "D0123ABCD", "channel_type": "im",
                   "thread_ts": "1794984673.401619"},
  "trigger": {"source": "event", "event_type": "message", "message_ts": "1794984673.401619",
              "actor": {"user_id": "U0123ABCD"}},
  "execution": {"run_kind": "dm_tool", "continuation": "none"}}}

@mention in a channel: when the app continues the conversation in your DM, conversation identifies that DM thread rather than the channel.

{"slack_bot": {
  "conversation": {"team_id": "T0123ABCD", "channel_id": "D0123ABCD", "thread_ts": "1794990012.000100"},
  "trigger": {"source": "event", "event_type": "app_mention", "message_ts": "1794990010.000200",
              "actor": {"user_id": "U0123ABCD"}},
  "execution": {"run_kind": "mention", "continuation": "none"}}}

@mention in a multiplayer channel: the request runs as the channel’s service user, and trigger.actor.user_id identifies the Slack user who mentioned the app.

{"slack_bot": {
  "conversation": {"team_id": "T0123ABCD", "channel_id": "C0123ABCD", "thread_ts": "1794984644.765499"},
  "trigger": {"source": "event", "event_type": "app_mention", "message_ts": "1794984644.765499",
              "actor": {"user_id": "U0123ABCD"}},
  "execution": {"run_kind": "tag", "continuation": "none"}}}

The RESOURCE_ATTRIBUTES column of each event identifies the Snowflake user and role that the request ran as.

Slack metadata on conversation threads

The first message in a Slack thread creates a Cortex Agents conversation thread. Later messages in the same Slack thread continue it. The app creates the conversation thread with origin_application set to slack_bot and stores the Slack location in the thread’s metadata. To read a thread, use the Threads API. Only the Snowflake user that the thread belongs to can read it: the connected user for a DM or @mention, or the service user for a multiplayer channel.

{
  "thread_id": 396953770607290,
  "origin_application": "slack_bot",
  "origin_mode": "INTERACTIVE",
  "metadata": {
    "slack": {"team_id": "T0123ABCD", "channel_id": "C0123ABCD", "thread_ts": "1794984644.765499"},
    "restricted_session_scope": "MY_DB.MY_SCHEMA.MY_SESSION_SCOPE"
  }
}
FieldDescription
metadata.slack.team_idID of the Slack workspace.
metadata.slack.channel_idID of the Slack conversation: a DM, a channel, or a private channel.
metadata.slack.thread_tsTimestamp of the Slack thread.
metadata.restricted_session_scopeRestricted session scope that the thread’s requests run under. Present only for multiplayer channels whose binding sets one.

The app writes this metadata when it creates the thread and doesn’t update it afterward. The thread’s thread_id matches snow.ai.observability.agent.thread_id in the monitoring events for the same conversation.

Limitations

During the preview, the integration has the following limitations:

  • No outbound internet access. CoCo runs in a sandbox that can’t reach the public internet, so it can’t clone an external repository or fetch a page or package from the web. To give CoCo code or other files to work with, upload them to your Snowflake workspace, or paste the contents into your message.
  • Answers in channels are per-user. When you @mention the app in a channel, only you see the answer until you select Share in thread. A thread doesn’t yet act as a shared session where every member can continue the same conversation.
  • One Snowflake account per Slack workspace. A Slack workspace can connect to only one Snowflake account.

Troubleshooting

Settings fail to save

When you save account-level Slack settings in Snowsight, the save can fail. Snowsight reports that it could not save the settings. This happens when the account doesn’t have a default Cortex Code (CoCo) settings agent.

Before you change those settings, create the CORTEX_CODE.CONFIG.DEFAULT agent, then try again. For instructions, see Configure default model settings.

Support and privacy

For questions about this integration, contact your Snowflake account team or Snowflake Support.

Where your configuration of Cortex Code uses a model provided on the Model and Service Pass-Through Terms, your use of that model is further subject to the terms for that model on that page.

The data classification of inputs and outputs are as set forth in the following table.

Input data classificationOutput data classificationDesignation
Usage DataCustomer Data

Covered AI Features

[1]

For additional information, refer to Snowflake AI and ML.