Skip to content

A Slack AI chatbot application using Amazon Bedrock for single question-and-answer format without continuous conversation history

License

Notifications You must be signed in to change notification settings

haruka-aibara/bedrock-slack-ai-chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bedrock-slack-ai-chatbot

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で動かす)

Architecture-Diagram

image Source: https://dev.classmethod.jp/articles/amazon-bedrock-slack-chat-bot-part2/#toc-step-3-bedrock


Resources Created

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.


How To Use

Mention @app_name to get a response. image


Installation Guide

Prerequisites

  • Terraform installed on your local machine
  • AWS CLI configured with appropriate credentials
  • A Slack app created with bot token and signing secret

Steps

  1. Clone the repository to your local machine.

  2. Navigate to the project directory.

  3. 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.

  1. Initialize Terraform:

    terraform init
    
  2. Apply the Terraform configuration:

    terraform apply
    

    Review the planned changes and type yes when prompted to create the resources.

  3. After the apply is complete, note the API Gateway endpoint URL in the Terraform output.

  4. 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.
  5. Save the Slack App configuration.

Your Slack AI chatbot should now be ready to use!

About

A Slack AI chatbot application using Amazon Bedrock for single question-and-answer format without continuous conversation history

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published