When a user mentions an Agentforce agent in a Slack channel or thread, Slack sends the channel ID and thread ts to the agent as session variables. Salesforce ignores the values sent from Slack unless the agent declares the variables. This article explains how to declare the variables in an Agentforce agent and use them in Flow or Apex actions.
This article explains how an Agentforce agent can read the ID of the Slack channel and the ts (timestamp) of the Slack thread where a user mentioned the agent while the agent is running. The agent can read the values that Slack sends after the variables are declared in the agent.
When a user mentions the agent in a Slack channel, Slack starts the session with the following variables.
Slack sends the same variables with every later message in the same session. The values stay correct when the agent is mentioned again in the same thread.
The following conditions apply when you declare the variables in the Agentforce agent.
Follow these steps to declare the variables in the agent and pass the values to actions.
`variables:
slack_channel: mutable string
label: "Slack Channel ID"
description: "The Slack channel the user is talking to the agent in."
visibility: "External"
slack_thread_ts: mutable string
label: "Slack Thread TS"
description: "The ts of the Slack thread the agent is replying in."
visibility: "External"`
Because the variable names match exactly and the visibility is External, the agent can receive the values that Slack sends.005466770

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.