Skip to content

remarkablemark/slack-bolt-hello-world

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Slack Bolt - Hello World

Run on Repl.it GitHub last commit

The Slack app displays a welcome message when a user opens "app home". It's inspired by the "Hello World, Bolt ⚡️ - Building your very first app with Bolt" tutorial.

The app is built with:

Watch the YouTube video or check out Repl.it.

Prerequisites

Requirements

Create a Slack app

Go to Features > OAuth & Permissions:

  1. Scopes > Bot Token Scopes > Add an OAuth Scope: chat:write
  2. OAuth Tokens for Your Workspace > Install to Workspace

Go to Features > Event Subscriptions:

  1. Enable Events: On
  2. Request URL: https://my.app.com/slack/events
  3. Subscribe to bot events > Add Workspace Event: app_home_opened
  4. Save Changes

Environment Variables

Create .env from .env.example:

cp .env.example .env

Copy the Signing Secret:

  • Settings > Basic Information > App Credentials > Signing Secret

Copy the Bot User OAuth Token:

  • Settings > Install App > OAuth Tokens for Your Workspace > Bot User OAuth Token

Set the environment variables:

SLACK_SIGNING_SECRET=abc123
SLACK_BOT_USER_OAUTH_TOKEN=xoxb-123-456-abc

Run

Run your app:

npm start

Your Bolt app will be listening at: http://localhost:3000/slack/events

Press Ctrl + C to stop the app.

To expose your local server to the public internet, use ngrok:

ngrok http 3000

Update the Request URL in Requirements to your ngrok URL:

https://123abc.ngrok.io

Features

  • The app_home_opened event gets triggered when a user opens the bot's "app home" for the first time
  • The app uses the Bolt's say method to send a welcome message to the user

Scopes

Events

Workspace events

License

MIT