You are browsing as a guest. Sign up (or log in) to start making projects!

My first slack bot!

  • 2 Devlogs
  • 1 Total hours

This bot isn't slacking off, it replies to messages 24/7!

Ship #1

My first Slack bot that actually stays alive 24/7!
I built a Slack bot with Node.js and the Bolt framework that runs continuously on a Linux server, managed by systemd. It has four slash commands: /miobot-ping (checks the bot's response time), /miobot-help (lists available commands), and a joke command that fetches a random joke from an external API and a cat fact command wich does pretty the same as the joke command but about cat facts.
What was challenging: Getting the bot to survive on a real server was way harder than running it on my laptop. I dealt with a systemd config that pointed to the wrong folder, an expired Slack token causing invalid_auth errors, and a slash command that silently failed because the name registered on Slack's dashboard didn't match the one in my code. Lots of late-night log reading with journalctl!
What I'm proud of: The bot now restarts itself automatically if it ever crashes, and stays online even when my laptop is off. It genuinely feels like running real infrastructure, not just a script.
To test it: Type /miobot-help in Slack to see all commands, then try /miobot-ping to see it respond instantly with the bot's latency!
The screenshot shows how it funcions on mobile while computer is turned off.

Try project → See source code →
Open comments for this post

17m 48s logged

Spent way too long debugging why /miobot-latency wasn’t responding… only to realize the Slash Command registered on Slack’s dashboard had a completely different name than the one in my code. Two typos, zero communication, one very confused bot. 🤦 Classic case of “it’s not a bug, it’s a naming mismatch.” Fixed it, restarted the service, and now the bot replies instantly with the latency. Lesson learned: always double-check that your Slack command name matches exactly — Slack doesn’t do fuzzy matching!
But in my defense regarding my mistake, I wanted to quote Shakespeare

0
0
3
Open comments for this post

1h 6m 6s logged

Today I finally got my Slack bot running 24/7 on a real Linux server — and it was NOT easy.The goal was simple: deploy my Node.js Slack bot on Hack Club’s Nest server using systemd so it stays alive forever, even when my laptop is off. What followed was a 2-hour debugging marathon.Everything that went wrong (and why):Pasted the systemd config file in nano and accidentally cut the first line [Unit] — Linux silently rejected the whole fileGot stuck in the systemd pager (those mysterious : symbols) and didn’t know to press q to exit — my next command turned into qsudo 😅VS Code focus switched back to my local Windows terminal without me noticing — suddenly sudo and nano didn’t exist because I was on PowerShellThe project folder was at /root/miobot_project but the service file pointed to /home/federico/miobot_project — which doesn’t existThe .env file had the tokens but the SLACK_APP_TOKEN was expired and giving invalid_authWhat I learned: Linux doesn’t hold your hand. Every error message means something specific. journalctl -u slackbot.service -n 30 became my best friend for reading crash logs.Final result: Active: active (running) 🟢 The bot is live, systemd restarts it automatically if it ever crashes, and it will survive server reboots. First project shipped on real infrastructure!

0
0
17

Followers

Loading…