š„Letās Do DevOps: Building a Slack Bot with AI Capabilities ā From Scratch! Part 3: Connect Slack and Claude Sonnet with Ngrokš„
aka, Lets get this Slack AI talking with A LOT of python
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: How to deploy an AWS Bedrock AI resource and connect to it to ask a request locally from your terminal with python3
- Part 3 (this post): Weāll connect our slack bot with Bedrock locally using python3 with ngrok so slack users can have conversations with AI
- Part 4 (link coming when published): How to convert your local script to an event-driven serverless, cloud-based app in AWS Lambda
Hey all!
In part 1, we build a slack bot and connected it to a local python instance. In part 2, we deployed an AWS Bedrock AI with guardrails, and connected to it with local python.
In this article, weāre going to connect the two. First, weāll get our slack bot listening on a local port. Then weāll get ngrok going, which is a tool thatāll help proxy a public request to our private port, and let us receive direct webhook messages from slack when folks tag our bot ā itās how weāll deploy when weāre properly in production, so testing it out locally is a great idea.
And then weāll connect both our message and the slack thread information to our AI request, so we can complete a whole circuit. By the time this article is done, weāll have a working AI slack bot.
Iāve started to call this AI bot Vera, and use she/her pronouns by convention
Notably, this awesome slack bot will depend on ngrok, a third party (that we have to assume is insecure, even if the company is amazing and isnāt), and will depend on your computer remaining on and this terminal remaining open.
In the next (and last!) part, weāre going to convert the whole shebank to an AWS Lambda so we donāt have to keep anything running locally on our computer.
If youād rather skip over all this exposition and just read the code, you can do so here:
https://github.com/KyMidd/SlackAIBotServerless/blob/master/python/devopsbot.py
This is going to be awesome. Letās get started.
Letās Do DevOps
From here on out, all content will be published on Letās Do DevOps. I want to give back to the community as much as Iām able. Please subscribe there to avoid missing any content. Thanks all ā¤.
This article is available on LetsDoDevOps, please subscribe there to support my work! ā¤