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

My slack bot

  • 2 Devlogs
  • 6 Total hours

A Hack Club Slack bot for the Stardance mission. It connects to Slack over Socket Mode (a WebSocket, no public URL) using Slack Bolt for Node.js, and answers slash commands: /sripin-ping reports the bot's latency, /sripin-help lists commands, and /sripin-catfact / /sripin-joke fetch from public APIs with error handling. Includes an HTTP health endpoint and a systemd service for 24/7 hosting on Nest.

Ship #1 Pending review

what did you make?
a slack bot for hack club with 11 slash commands, all prefixed /sripin- so they don’t clash with other bots. it does weather, dictionary lookups, jokes, cat facts, quotes, dice rolls, a magic 8-ball, coin flips and more, built on slack bolt over socket mode.

what was challenging?
getting the two slack tokens right and understanding socket mode, since the bot has no public url and just opens a websocket to slack. also hit a bug where my little health server would crash the whole bot if its port was taken.

what are you proud of?
that it’s actually solid, not just a toy. every api call has a timeout and try/catch so a dead api can’t kill it, a couple have offline fallbacks, and it shuts down cleanly so systemd restarts don’t break anything.

what should people know so they can test it?
invite the bot to a channel like #bot-spam, then try /sripin-help to see everything. good ones to start with: /sripin-weather london, /sripin-roll 2d6, /sripin-8ball will this work, /sripin-define serendipity.

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

35m 20s logged

built the bot on node + slack bolt in socket mode, so it talks to slack over a websocket with no public url. made the slack app from a manifest (auto-adds the slash commands, scopes, socket mode and the @mention event), generated the app-level and bot tokens, dropped them in a gitignored .env, and verified both against the slack api — “bot is running! now connected to slack”.then made it better: 11 commands now, all prefixed /sripin- so they don’t collide with other bots — ping, help, catfact, joke, quote, weather (wttr.in, no api key), define, 8ball, roll (NdM dice), flip, choose. every api call has a timeout and try/catch so a dead api can’t crash the bot, and a couple have offline fallbacks. fun commands post in-channel so everyone sees them. also fixed a real bug where the little http health endpoint would kill the whole bot if its port was taken, now it just disables itself — and added an error handler, clean sigint/sigterm shutdown, and a line that logs every incoming command. last step is deploying to hack club nest so it stays live 24/7 with my laptop closed.

0
0
8
Open comments for this post

4h 56m 29s logged

day 1 on my stardance slack bot. started by reading through the whole guide so i knew what i was building - a slack bot that answers slash commands. first thing i actually set up was builting the bot itself - a node project using slack bolt in socket mode, so it talks to slack over a websocket and doesn’t need a public url. wrote four slash commands: /sripin-ping replies with the bot’s latency, /sripin-help lists the commands, and /sripin-catfact and /sripin-joke pull from public apis with axios and have try/catch so a dead api doesn’t crash the bot. also added a tiny http health endpoint on port 3000 so there’s still something to open in a browser, plus a systemd service file for deploying on nest later. set up the git repo, wrote the readme, and pushed everything to github. next up: make the actual slack app, get the xoxb + xapp tokens into .env, run npm install, and test it live in #bot-spam.

0
0
76

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…