Slack
Connect Slack to Squid to send AI-powered messages
The Slack connector's functionality
The Slack connector currently supports:
- Sending messages to channels, groups, and individual users.
- By providing AI agents with these capabilities, users can simply ask the AI agent to send a message, and the agent will take the desired action.
- Users may also message the AI agent from Slack, and the Slack connector will relay the agent's response directly within Slack.
- The connector can read all conversations into a knowledge base to enable users to ask the AI agent for more intelligent searches or 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 Information tab of your Slack app's settings.
Client ID: The Client ID of the Slack application, which can also be found on the Basic Information tab.
Bot User OAuth Token: The Bot User OAuth token of the Slack application, which can be found on the OAuth & Permissions tab. This token is used to authenticate the requests to the Slack API.
Client Secret: The Client Secret of the Slack app, which can be found on the Basic Information tab.
Signing Secret: The Signing Secret of the Slack app, which can be found on the Basic Information tab.
Verification Token: The Verification Token of the Slack app, which can be found on the Basic Information tab.
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.
Using the Slack connector in your application
There are three ways to use the Slack connector in your application:
-
Using the Agent Studio: If you are using the Agent Studio to create your AI agent, you can add the Slack connector by clicking the Add Abilities button and adding the Slack ability. Learn more about abilities here. After adding the ability, you can ask your agent to send Slack messages in the Test Agent tab. To try searching messages using the agent, please allow a couple of hours for Squid to index the Slack messages. Example messages:
Search 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'
});