Before you can write any code, you need to register your bot with Slack and grab the tokens it’ll use to authenticate.
1. Create the app
- Go to the Slack Apps dashboard: https://api.slack.com/apps and click Create New App → From scratch.
- Give it a name and pick the Hack Club workspace.
- Click Create App.
2. Enable Socket Mode
Socket Mode lets your bot talk to Slack over a WebSocket so you don’t need a public URL.
- Open the Socket Mode page in your app’s left sidebar.
- Toggle Enable Socket Mode on.

Socket Mode needs an App-Level Token with the connections:write scope:
- Open Basic Information in the left sidebar.

- Scroll to App-Level Tokens and click Generate Token and Scopes.

- Give the token a name (e.g.
my-bot-socket) and add the connections:write scope.

- Click Generate and copy the token immediately. App-level tokens start with
xapp-.

3. Set bot scopes
Scopes tell Slack what your bot is allowed to do.
-
Open OAuth & Permissions in the left sidebar.

-
Under Bot Token Scopes, add:

chat:write
commands
app_mentions:read
channels:history
These permissions let your bot send messages, use slash commands, read mentions, and access channel messages. You can always add more later.
4. Install the app to your workspace
- Go to Install App in the left sidebar and click Install to Workspace.
- Grant permissions.

- Back on OAuth & Permissions, you’ll see the Bot User OAuth Token (starts with
xoxb-). Copy and save it.

5. Add a slash command
- Open Slash Commands in the left sidebar and click Create New Command.

- Enter a command name like
/dsb-ping and provide a short description and usage hint.
- Click Save.
Where to find tokens later
If you lose a token, you can always go back:
- App-Level Token (
xapp-) — Basic Information → App-Level Tokens → click the token name.
- Bot User OAuth Token (
xoxb-) — OAuth & Permissions → look for Bot User OAuth Token after installing the app.