š„Building a Slack Bot with AI Capabilities - From Scratch! Part 2: AWS Bedrock and Pythonš„
aka, "oh hey there world-eating AI, can you do a small task for me, as a favor?"
This blog series focuses on presenting complex DevOps projects as simple and approachable via plain language and lots of pictures. You can do it!
This article is part of a series of articles, because 1 article would be absolutely massive.
Part 1: Covers how to build a slack bot in websocket mode and connect to it with python
Part 2 (this article): How to deploy an AWS Bedrock AI resource and connect to it to ask a request locally from your terminal with python3
Part 4: How to convert your local script to an event-driven serverless, cloud-based app in AWS Lambda
Hey all!
During the last article, we went over how to build a slack app that can listen for tags in shared rooms, or for DMs from your users. We connected it with websocket mode, which is great for testing, but less so for enterprise consumption.
However, we didnāt see it really *do* anything - we got a json packaged āokā that our slack app is connected, but weāre not posting anything back to slack. Thatāll change in this article.
Weāre going to get our AI ready inside AWS BedRock, where weāll deploy Anthropicās Claude v3.5 Sonnet. Then weāll update our python script to connect to it and serve queries.
THEN weāll stitch the two together so you can locally run your python script and itāll receive queries from slack, then relay those requests to Bedrock, then get responses and post them back to Slack. This will create a fully functional Bedrock AI chat bot.
Thatās not going to quite get to enterprise quality - running any bridge script forever on a single machine is going to break a lot. Like, your machine will hibernate or reboot sometimes, right? So in the next article weāll talk about how we can embed this script in an AWS Lambda thatāll receive webhooks from the slack app, and do all the stitching work of connecting it to Bedrock. Thatāll run forever in the cloud, and never require us to touch it again, lazy (over?-)engineering at its finest!.
With no further ado, lets dive in!
Keep reading with a 7-day free trial
Subscribe to Let's Do DevOps to keep reading this post and get 7 days of free access to the full post archives.