7 ms·
Show HN: A framework for building Slack bots in Python
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!
- jtwaleson 4y agoHow do you deploy this? I want to run slack bots on 0 running costs where possible.
- DandyDev 4y agoAnywhere you can run Python code basically. Sadly, with the decline of Heroku, I don't know of any places you can run Python code 24/7 for free. Myself, 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.
- seabrookmx 4y agoGoogle Compute Engine has a free tier. The developer experience isn't nearly as smooth as Heroku though.
- mritchie712 4y agoYou could probably use Cloud Run (it will run a python docker container), it scales to 0
- jtwaleson 4y agoI created a micro framework for slack bots that can be deployed to Lambda here: https://github.com/jtwaleson/minimalistic-serverless-slack-app https://github.com/jtwaleson/minimalistic-serverless-slack-a... It’s probably a lot less rich than your solution, but feel free to look at it you want to run on serverless.
- icey 4y agoMaybe fly.io? They have a pretty generous free tier.
- drhayes9 4y agoI've been having fun using fly.io for a Telegram bot (listens on an HTTPS endpoint like a Slack bot, if I remember right). Has cost me $0 for my hobbyist bot that is only used by me.
- aquajet 4y agoI'm sure you can set up a raspi to deploy this with minimal running costs.
- leathersoft 4y agoPretty interesting. I’ll have a look.
- tanepiper 4y agoThis looks really nice, I've been looking for something to build a bot.
- bkanuka 4y agoI really like the API and decorators! What I don't see in the documentation is how to respond to events from outside Slack Machine. For example an external message queue. 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".
- DandyDev 4y agoThat is an interesting use case! The solution you propose, could work. 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.
- bkanuka 4y agoYes a webhook could work!
- shabbatt 4y agoHow does one monetize and sell slack bots, is it even done?
- zoover2020 4y agoI'd argue it's more about service or API integration. 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.
- dijit 4y agoIf you're trying to get a `worse than zulip` experience but really like threads then your only option is a paid bot called Smithy: https://smithy.app https://smithy.app So at least someone is making money from bots.
- turtlebits 4y agoSlack workflows are pretty powerful, and there is definitely a gap in available actions (steps).
- 147 4y agoI'm working on a Slack bot that I'm hoping to monetize.
- steveBK123 4y agoI'd pay for a slack bot that detects which of the channels I've been involuntarily added to has messages from bots and proactively mutes them for me.
- pbreit 4y agoHas anyone ever found a bot-generated message in Slack to be useful?
- zoover2020 4y agoI'd say ChatOps is a very legitimate use case. But I see your underlying point of bots frontloaded with a lot of logic.
- mod 4y agoSure. We used to have one that reported any error on any web app we had deployed. 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.
- steveBK123 4y agoHow many users x requests do you have that a slack per error is actually something you can live with?
- Noumenon72 4y agoWeekly reminder to fill out a report is nice. I would like Jenkins to send me a Slack message when my build fails.
- paxys 4y agoGrafana alerts. GitHub PR requests. Jenkins builds. Surveys. Google Drive shares/comments. Dozens of other internal tooling integrations. I can't imagine working without slack bots at this point.
- steveBK123 4y agoHow big is your team that the amount of these bot alerts is not something that just fades into background noise?
- rcarmo 4y agoI especially like that it uses sockets and not an open HTTP endpoint. I've been messing about with Slack bots for a while and will certainly give this a look.
- Noumenon72 4y agoLeading with "wonderful" confused me a little. I was expecting "X is a wonderful project. Here is a new project built on X." When introducing your own project, your subjective praise for it doesn't add as much. I would drop the "wonderful".
- DandyDev 4y agoI think you make a good point. I removed that word from the description.
- dijit 4y agoInteresting Project. I'm sure you're aware of Errbot (https://github.com/errbotio/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.
- DandyDev 4y agoIt's not a naive question at all! The 2 biggest differences I can see: - 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.