Show HN: A framework for building Slack bots in Python (github.com)
I started building a couple of years ago because I found no easy existing solution to build Slack bots that can be composed from/organized into plugins. Existing libraries like Bolt make it pretty easy to develop Slack bots, but hard to organize and scale the code base of your bot. I was also missing some crucial features such as scheduling actions for your bot. So I wrote my own framework!
I recently rewrote the complete framework to make use of asyncio and the newest Slack SDK
Let me know what you think!
40 comments
[ 2.9 ms ] story [ 91.3 ms ] threadMyself, I run Slack bots on AWS inside a Docker container on ECS (for $day_job) and inside a Docker container on my Synology for personal use.
It’s probably a lot less rich than your solution, but feel free to look at it you want to run on serverless.
I suppose I could look into writing a coroutine that listens for messages on a queue and then runs the `emit()` from SM - just not clear to me if that's the "right way".
I've also been meaning to add support for webhooks as well, so you could trigger plugin functions by calling an HTTP endpoint. It's a small step from having messages on a queue and triggering webhooks from them.
People are willing to pay for solid solutions as long as you can add value
For instance, let's say PagerDuty did not have Slack integration. If you decide to build the glue that connects both you already have a ton of potential clients as they don't want to invest money themselves etc.
So at least someone is making money from bots.
You could use other types of reporting, of course, but that worked for us.
Any important information could be reported by the bot instead of wherever you normally find it.
It's a matter of what you build it to do.
I can't imagine working without slack bots at this point.
Works really well and has the effect that inter-department communication don't always need to go through the department heads. This could, of course be abused for spam, but so far it worked well.
It's very useful for us right now at our current scale. Should we start getting an inordinate amount of new signups everyday, we will have to start relying on other methods to understand the signups.
Having all the notifications just coming into one place is really good for "situational awareness" and I think it's one of Slack's main killer use cases.
Pretty much any github/jifa/wiki/servicenow/error log/etc type chat bot integration immediately become background noise as soon as your team exceeds a size of about 4 or your user base exceeds a number you can count on your hands.
Everyone slowly mutes or ignores notifications on those channels and goes about their day.
Having used it for ~7 years at a bunch of companies, I can say with confidence that bots are a very core part of Slack’s value.
There certainly are spammy notifications that sound useful and turn out not to be, but it’s not hard to keep the signal to noise ratio high with a little effort.
I'm sure you're aware of Errbot (https://github.com/errbotio/errbot), though not specifically designed with slack in mind: I have had excellent success with this framework.
How does slack-machine compare?
PS: Please forgive the naive question, I'm about the board a flight and don't see anything mentioned or anything radically different about the stated goals.
- Errbot being chat service agnostic, also makes it feel a bit "non-native" for Slack. For example, you cannot say "@mybot deploy webapp to production", but you have to say "!mybot deploy webapp to production". slack-machine can work that way as well (with command prefixes like ! or %), but it also responds to actual mentions (@mybot). There are more differences like that, where Errbot tries to be agnostic of the chat service it's running against, but that also means it has to cater to the lowest common denominator in terms of integration with a chat service. slack-machine can for example add "reactions" to messages, which Errbot cannot.
- slack-machine seems more feature-rich. Errbot seems to be focused only on commands that are triggered by sending certain chat messages. slack-machine lets you listen to any type of event Slack emits. Examples could be: someone joins a channel, a reaction is added to a message, a message is pinned. slack-machine also has built-in scheduling to trigger plugin functions on a cron-like schedule (Errbot has something similar with pollers, but it's not as flexible as a cron schedule)
For me it was a clear design choice to focus only on Slack, so the bots you build with it feel as "integrated" as possible with Slack. You can really leverage all that the Slack API has to offer.