Always-On Slack Bot — shipped and running 24/7Wanted to build a Slack bot that never goes offline and just answers whatever you throw at it. Got it done this week.I used JavaScript with Slack’s Bolt framework in Socket Mode, so the bot talks to Slack over a WebSocket instead of needing a public URL. It has 10 slash commands so far: /ao-help, /ao-joke, /ao-quote, a magic 8-ball, a coin flip, a dice roller, /ao-time, and /ao-catfact which pulls a random fact from a live API. I kept all the reply logic in its own file with zero Slack code in it, which let me write real unit tests for it (15 of them, all passing).The part I’m happiest with is the hosting. Rather than a free web host that falls asleep after a few minutes, I put it on Hack Club Nest as a systemd service. It auto-restarts if it crashes and comes back up on reboot, so it’s genuinely online around the clock. I also gave it a small status page so there’s a link you can actually open: https://bot.akshajdewan102.hackclub.appThings I learned the hard way: Nest containers are just plain Debian, so I had to apt install node and git myself before anything would run, and Socket Mode needs two separate tokens (a bot token and an app-level token) which took me a minute to figure out.Next up: a few more commands, and maybe a small database if I want it to remember anything between messages.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.