Slack
Connect Slack to Squid to send AI-powered messages
Slack connector functionality
The Slack connector supports:
- Sending messages to channels, groups, and individual users
- Interacting with Squid AI agents directly in Slack via SlackBot
- Reading conversations into a knowledge base for intelligent search and summaries
Configuring the Slack connector
Squid connects to a Slack application to send and read messages in your Slack workspace.
Creating a Slack application
- Navigate to the Slack applications landing page.
- Click Create New App and provide a meaningful App Name and the corresponding Slack workspace.
Adding the Slack connector to your Squid application
-
Navigate to the Squid Console and select the Connectors tab.
-
Switch to the Available Connectors tab and add a Slack connector.
-
The configuration details can all be found on the settings page of the Slack application you just created:
Connector ID: A meaningful string that uniquely identifies the connector in the code.
App ID: The ID of the Slack application, which can be found on the
Basic Informationtab of your Slack app's settings.Client ID: The Client ID of the Slack application, which can also be found on the
Basic Informationtab.Verification Token: The Verification Token of the Slack app, which can be found on the
Basic Informationtab.Client Secret: The Client Secret of the Slack app, which can be found on the
Basic Informationtab.Signing Secret: The Signing Secret of the Slack app, which can be found on the
Basic Informationtab.
Bot User OAuth Token: The Bot User OAuth token of the Slack application, which can be found on the
OAuth & Permissionstab. This token is used to authenticate the requests to the Slack API.
Index Channels: Whether Squid should read all messages (from the channels the bot is added to) to offer intelligent searches and summaries.
Message History Limit: When messaging Squid via Slack, Squid will read this many prior messages to provide itself enough context to best answer the user.
-
Navigate to the OAuth & Permissions tab and ensure that the following Bot Token Scopes are added:
app_mentions:readchannels:historychannels:joinchannels:readchat:writechat:write.publicfiles:readfiles:writegroups:historygroups:readim:historyim:readim:writempim:historympim:readmpim:writeusers:readusers:read.email
Using the Slack connector in your application
There are three ways to use the Slack connector in your application:
-
Using the Agent Studio: In Agent Studio, add the Slack connector via Add Abilities > Slack. Learn more about abilities. You can then test sending messages in the Test Agent tab. For message searching, allow a couple of hours for Squid to index your Slack messages. Example messages:
Send a slack message saying "Hello!" to James- Where "James" is a Slack userPost "The deployment was successful!" to the #devops channelSearch Slack for conversations about the product launchShow me all discussions in the Engineering team about API designFind messages in the Finance channel about budget planning
-
Using the Squid SDK: If you are using the Squid SDK to create your AI agent, you can use the
squid.ai().agent('AGENT_ID').ask()function to chat with your agent. Learn more here. Use the Slack connector by adding it in theconnectedIntegrationsoption of theask()function.
// Configuration to let the agent be aware of the Slack connector.
const config = {
connectedIntegrations: [{
integrationId: 'SLACK_CONNECTOR_ID',
integrationType: 'slack',
description: 'Call this connector whenever a user asks to send or search Slack messages',
}]
};
// Send a message.
await this.squid.ai().agent('AGENT_ID').ask('Send a slack message saying "Hello!" to the general channel', config);
// Search messages related to your search.
await this.squid.ai().agent('AGENT_ID').ask('Find messages in the Finance channel about budget planning.', config);
- Using the NPM package: If you use
@squidcloud/slack-client, you can:
// Initialize the client.
const slackClient = SquidSlackClient(this.squid, 'SLACK_CONNECTOR_ID');
// Send a message.
await slackClient.sendMessage({
recipient: 'general',
recipientType: 'channel',
message: 'Hello!'
});
// Find messages related to your search.
await slackClient.searchMessages({
channelNames: 'general,random',
prompt: 'need help'
});
Interacting with AI Agents via SlackBot
To interact with AI agents directly in Slack, you can set up the SlackBot functionality in your Slack application as follows:
- In your Slack application settings, navigate to the Event Subscriptions tab.
- Toggle Enable Events to ON
- Under Request URL, enter the Webhook URL for Slack notification. The URL is in the following form:
https://[APP_ID]-[ENV_ID]-[DEVELOPER_ID].[REGION].squid.cloud/webhooks/slackNotification?agentId=[AGENT_ID]
[DEVELOPER-ID] is only required when you are running backend locally. When deploying it to squid it is omitted, for example:
https://9kxp2nvqtcfflwazoe-dev.us-east-1.aws.squid.cloud/webhooks/slackNotification?agentId=quote-agent
- Under Subscribe to Bot Events, add the following events:
message.im- to receive direct messages sent to the botapp_mention- to receive messages where the bot is mentioned in channels
That's it! When users message your SlackBot, Squid will forward the prompt to the specified agent and respond directly in Slack.