šŸ”„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

Kyler Middleton
2 min readJan 7, 2025

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.

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! ā¤

--

--

Kyler Middleton
Kyler Middleton

Written by Kyler Middleton

DevNetSecOps, DevRel, cloud security chick. I will teach you, itā€™s unavoidable. She/Her šŸ³ļøā€šŸŒˆšŸ³ļøā€šŸŒˆ, INFJ-A, support the EFF!

No responses yet