In today's fast-paced digital world, optimizing workflows and increasing productivity is paramount. That's why we're excited to share an exciting integration that will take your team's collaboration to new heights. Get ready to unlock the power of generative artificial intelligence (ai) and bring it directly to your Slack workspace.
Imagine the possibilities: fast and efficient brainstorming sessions, real-time ideas, and even drafting documents or code snippets, all powered by the latest advances in ai. Say goodbye to context switching and hello to a streamlined collaborative experience that will boost your team's productivity. Whether you're leading a dynamic team, working on complex projects, or simply looking to improve your Loose experience, this integration changes the rules of the game.
In this post, we show you how to unlock new levels of efficiency and creativity by bringing the power of generative ai directly to your Slack workspace using amazon Bedrock.
Solution Overview
amazon Bedrock is a fully managed service that offers a selection of high-performance foundation models (FMs) from leading ai companies such as AI21 Labs, Anthropic, Cohere, Meta, Stability ai, and amazon through a single API, along with a broad set of capabilities to build generative ai applications with security, privacy, and responsible ai.
In the following sections, we'll walk you through the process of setting up a Slack integration for amazon Bedrock. We show how to create a Slack app, configure the necessary permissions, and deploy the necessary resources using AWS CloudFormation.
The following diagram illustrates the architecture of the solution.
The workflow consists of the following steps:
- The user communicates with the Slack application.
- The Slack app sends the event to the amazon API Gateway, which is used to subscribe to the event.
- API Gateway forwards the event to an AWS Lambda function.
- The Lambda function invokes amazon Bedrock with the request and then responds to the user in Slack.
Previous requirements
You need an AWS account and an AWS Identity and Access Management (IAM) user and role with permissions to create and manage the resources and components required for this application. If you don't have an AWS account, see How do I create and activate a new amazon Web Services account?
You also need an existing account with access to the provided amazon Bedrock model. If you don't have model permission, see Model Access.
Lastly, you need a Slack account and access to create and publish apps to your Slack organization. If you don't have one, ask your company to create a Slack sandbox organization so you can experiment or go to Loose to create a free Slack account and workspace.
Create a lazy application
Security settings vary between organizations. To manage your Slack workspace settings, contact your Slack administrator or, as an administrator, complete the following steps:
- Navigate to the administration section within Loose and choose Build.
- Choose Create new application.
- For Application nameEnter a name for your app (for this post, we call it
BedrockSlackIntegration
). - Choose your workspace.
- Choose Create application.
After creating the app, you can configure its permissions. - On the app details page, choose Basic information in the navigation panel.
- Low Add features and functionalitychoose Permissions
- In it Scopes section, add the scopes
im:read
,im:write
andchat:write
.
About him Basic information page, robots and Permissions Now both should have a green check mark.
- Low Install your applicationchoose Install to workspace.
- When prompted to install, choose Allow.
- Open the amazon Bedrock console and choose Access to the model in the navigation panel.
<img loading="lazy" class="aligncenter wp-image-77576 size-full" style="margin: 10px 0px 10px 0px;border: 1px solid #CCCCCC" src="https://technicalterrence.com/wp-content/uploads/2024/06/1718895957_578_Deploy-a-Slack-gateway-for-Amazon-Bedrock.png" alt="Provide access to the amazon Bedrock model” width=”2067″ height=”779″/> - You can select your model from the available list. For this post, we grant access to ai21.j2-ultra-v1 (Jurassic-2 Ultra). For more information about requesting access to the model, see Access to the model. Next, we deploy the code and connect to amazon Bedrock when we receive a Slack message. For that, we need the Slack bot token to use as an input parameter for the CloudFormation template in the next section.
- On the Slack app details page, choose OAuth and permissions in the navigation panel.
- Copy the value of Bot user OAuth token.
Deploy resources with AWS CloudFormation
Complete the following steps to start the CloudFormation stack:
- For First nameuse default or enter a name of your choice.
- For SlackTokenParamEnter the bot token you copied earlier.
- Choose Next.
- Create your stack and wait a few minutes for the deployment to complete.
- About him Departures tab, copy the value of
SlackBotEndpointOutput
to use in the following steps.
In the next section, we start integrating amazon Bedrock with Slack.
Integrate amazon Bedrock with Slack
After deploying your CloudFormation stack, complete the following steps:
- On the Slack app details page, choose Event Subscriptions in the navigation panel.
- Lever Enable events in.
The event subscription should be verified automatically.
- Under Subscribe to bot events, add the events
app_mention
andmessage.im
. - Choose Save Changes.
The integration is now complete.
Try the Slack bot
To test your bot, complete the following steps:
- Navigate to your Loose.
- Create a new group and add the app.
BedrockSlackIntegration
. - Start interacting with the amazon Bedrock bot using
@BedrockSlackIntegration.
Your interaction will look like the following screenshot.
The bot shown here does not have the status of your previous questions or your chat history with subsequent new messages. However, you can implement this using amazon DynamoDB. We will cover this in a later blog post.
Summary
In this post, we delve into amazon Bedrock's seamless integration with the popular collaboration platform Slack. The step-by-step guide demonstrated how to make a direct connection between these two powerful tools, allowing you and your team to harness the full potential of generative ai right within your Slack workspace. With this integration, you can streamline your workflow and improve productivity by making it easier to access the cutting-edge capabilities of generative ai. Whether you're looking to generate content, analyze data, or explore innovative ideas, this integration lets you do it all without leaving the familiar Slack environment.
You can further empower your team by implementing a Slack gateway for amazon Q Business, the generative ai assistant that empowers employees based on knowledge and data from your business systems. For more information about using generative ai with AWS services, see Generative ai on AWS.
About the authors
Rushabh Lokhande is a Senior Data and Machine Learning Engineer with AWS Professional Services Analytics Practice. He helps clients implement big data, machine learning, analytics solutions, and generative ai solutions. Outside of work, he enjoys spending time with family, reading, running, and playing golf.
Andrew Ang is a Senior Machine Learning Engineer in the AWS Generative ai Innovation Center, where he helps customers ideate and implement generative ai proof-of-concept projects. Outside of work, he enjoys playing squash and watching travel and food vlogs.
John Losito is an Associate Cloud Infrastructure Architect at AWS Professional Services, where he helps clients create automation scripts using AWS CDK or Terraform to efficiently deploy and manage cloud resources. Outside of work, he enjoys spending time with his family, exercising, and improving his archery skills.