What You're In For
- Bot Creation & Permissions: Quick stroll through Slack's settings. We'll be in and out like a fiddler's elbow.
- Bare Minimum Server: A light server to make Slack and your bot play nice.
- Event Subscriptions: Mandatory.
- Test Drive: Invite the bot, chat a bit.
Step 1: Bot Creation & Permissions
Creating a bot in Slack isn't a trust fall; it's more like a firm handshake. Here's how to do it:
- Workspace & App: Create a Slack workspace, if you don't have one. Then, fashion your app via Slack Apps.
- Keys & Secrets: Every good spy movie has a secret code. In this saga, it's called the "Signing Secret". Remember it.
-
OAuth & Permissions: Head over there in your Slack settings.
Add some scopes like
app_mentions:read
,channels:read
, andchat:write
. These scopes give your bot some social skills. - Install & Token: Finally, install your app to the workspace to snag that OAuth token.
Step 2: Bare Minimum Server
Our server's not going to solve world hunger, but it'll do its job. Get the starter code from here.
- Yarn Install: Fire up your terminal and let yarn do its magic.
-
Environment: In the
.env
file, place those two secret tokens from earlier. -
Run Server: A simple
yarn start:dev
will bring your server to life.
SSH your way into reality with this:
ssh -o ServerAliveInterval=60 -R kumbaya-my-lord-kumbaya:80:localhost:8888 serveo.net
Voila, https://kumbaya-my-lord-kumbaya.serveo.net
is your server's alter ego.
Step 3: Event Subscriptions
Back to Slack settings. Enable "Event Subscriptions" and paste this URL: https://kumbaya-my-lord-kumbaya.serveo.net/slack/events
. Then, subscribe to message.channels
.
Take It for a Spin
Invite your new bot to a Slack channel. Type "gimmeCat", and your bot becomes your personal feline photographer. Just don't expect it to feed the cat for you.
And that's Episode 1. More thrilling than a cup of decaf, wouldn't you agree? Stay tuned.
Feel free to copy, paste, and bask in your newfound bot glory. π€
Top comments (0)