DEV Community

Cover image for 🎬 Episode 1: Slack Bot & Server Setup
MEHMET ALI IZCI
MEHMET ALI IZCI

Posted on

🎬 Episode 1: Slack Bot & Server Setup

What You're In For

  1. Bot Creation & Permissions: Quick stroll through Slack's settings. We'll be in and out like a fiddler's elbow.
  2. Bare Minimum Server: A light server to make Slack and your bot play nice.
  3. Event Subscriptions: Mandatory.
  4. 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:

  1. Workspace & App: Create a Slack workspace, if you don't have one. Then, fashion your app via Slack Apps.
  2. Keys & Secrets: Every good spy movie has a secret code. In this saga, it's called the "Signing Secret". Remember it. SigninSecret
  3. OAuth & Permissions: Head over there in your Slack settings. Oauth-image Add some scopes like app_mentions:read, channels:read, and chat:write. These scopes give your bot some social skills.
  4. 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.

  1. Yarn Install: Fire up your terminal and let yarn do its magic.
  2. Environment: In the .env file, place those two secret tokens from earlier.
  3. 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
Enter fullscreen mode Exit fullscreen mode

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.

event subscription image

subscriptions

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.

final-result

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)