Slack
Slack access uses Socket Mode so users can mention the app, DM it, or continue in a thread, with replies sent back to the original channel or thread; direct local Slack connection is enabled unless SLACK_CHANNEL_DIRECT_ENABLED=false.
Usage Modes
| Mode | Trigger | Notes |
|---|---|---|
| Channel mention | Mention the app in a channel and enter a question | Good for team status checks, alert handling, and control commands. |
| App DM | Send a direct message to the app | Good for personal remote status queries and control. |
| Thread reply | Continue in the thread where the app replied | Keeps one device investigation or operation in a single Slack thread. |
Prepare the Slack App
- Create an app in Slack API Apps.
- In OAuth & Permissions → Bot Token Scopes, add:
chat:writeapp_mentions:readim:history
- In Event Subscriptions, subscribe to Bot Events:
app_mentionmessage.im
- Enable Socket Mode.
- In Basic Information → App-Level Tokens, create a token with
connections:writeand copy thexapp-...token. - In OAuth & Permissions, install the app to the workspace and copy the Bot User OAuth Token, usually
xoxb-.... - Copy Signing Secret from Basic Information.
Configure Device Agent
Open Settings → Channels → Slack and fill in:
| Field | .env | Description |
|---|---|---|
| Enabled | SLACK_ENABLED | Starts the Slack channel |
| Bot Token | SLACK_BOT_TOKEN | xoxb-... |
| App Token | SLACK_APP_TOKEN | xapp-... with connections:write |
| Signing Secret | SLACK_SIGNING_SECRET | Optional Slack app Signing Secret |
| Allow list | SLACK_ALLOW_FROM | Optional Slack user ID allow list |
You can also configure it in .env:
bash
SLACK_ENABLED=true
SLACK_BOT_TOKEN=xoxb-your-slack-bot-token
SLACK_APP_TOKEN=xapp-your-slack-app-token
SLACK_SIGNING_SECRET=your-signing-secret
SLACK_ALLOW_FROM=U01234567,U89ABCDEF
SLACK_CHANNEL_DIRECT_ENABLED=trueRestart the service after saving.
Verify Access
- Confirm the service has restarted.
- Check logs for
Slack: enabledandChannel started (Socket Mode). - Mention the app in a channel, or send a DM to the app.
- If the allow list is enabled, make sure the sender Slack user ID is included.
Channel replies are sent to the original thread. DMs reply directly in the DM conversation.
Checks
- No DM response: subscribe to
message.imand reinstall the app to the workspace. - No channel response: mention the app and confirm it has joined the channel.
- Socket Mode does not start: make sure
SLACK_APP_TOKENstarts withxapp-...and hasconnections:write. - Direct channel does not start: confirm
SLACK_CHANNEL_DIRECT_ENABLED=falseis not set.