A Slack AI chatbot application using Amazon Bedrock for single question-and-answer format without continuous conversation history
Functions as an HTTP API server using API Gateway
This Project was created with reference to the following: Amazon BedrockとSlackで生成AIチャットボットアプリを作る (その2:Lambda+API Gatewayで動かす)
Source: https://dev.classmethod.jp/articles/amazon-bedrock-slack-chat-bot-part2/#toc-step-3-bedrock
When you Terraform Apply this project, it creates the resources and configurations within the 'AWS Cloud' shown in the architecture diagram.
- API Gateway
- Lambda Layer
- Lambda Function
- Bedrock
- SQS
For the variables SLACK_BOT_TOKEN / SLACK_SIGNING_SECRET, use the values from your own Slack App.
Mention @app_name to get a response.
- Terraform installed on your local machine
- AWS CLI configured with appropriate credentials
- A Slack app created with bot token and signing secret
-
Clone the repository to your local machine.
-
Navigate to the project directory.
-
Set up Terraform variables:
-
Option A: set variable in HCP Terraform
slack_bot_token = "your-slack-bot-token" slack_signing_secret = "your-slack-signing-secret"
-
Option B: Local environment, e.g., Ubuntu
first, Open variables.tf and change the variable names to uppercase
then add env var
export SLACK_BOT_TOKEN="your-slack-bot-token" export SLACK_SIGNING_SECRET="your-slack-signing-secret"
Replace your-slack-bot-token and your-slack-signing-secret with your actual Slack App values.
-
Initialize Terraform:
terraform init
-
Apply the Terraform configuration:
terraform apply
Review the planned changes and type
yes
when prompted to create the resources. -
After the apply is complete, note the API Gateway endpoint URL in the Terraform output.
-
Configure Slack:
- Go to your Slack App's configuration page
- Navigate to "Event Subscriptions"
- Enable events
- In the "Request URL" field, enter:
{your-api-endpoint}/slack/events
Replace{your-api-endpoint}
with the actual API Gateway endpoint URL from step 6.
-
Save the Slack App configuration.
Your Slack AI chatbot should now be ready to use!