Slack
KhunQuant connects to Slack using Socket Mode, which establishes a persistent WebSocket connection to Slack's servers. No inbound public URL is required — all traffic is initiated outbound from your machine, making this the easiest channel to run behind a firewall or NAT.
Capabilities
- Direct message and channel message send/receive
- Threaded replies (channel messages are automatically threaded)
- Typing indicator
- Processing placeholder message (
"Thinking...") - Emoji acknowledgement reactions (✅)
- File uploads
- Allow-listing by Slack user ID
- Dedicated reasoning output channel
Configuration
Add to ~/.khunquant/config.json:
{
"channels": {
"slack": {
"enabled": true,
"bot_token": "xoxb-YOUR-BOT-TOKEN",
"app_token": "xapp-YOUR-APP-TOKEN",
"allow_from": [],
"group_trigger": {
"mention_only": true
},
"typing": {
"enabled": true
},
"placeholder": {
"enabled": true,
"text": "Thinking..."
},
"reasoning_channel_id": ""
}
}
}
Store tokens in ~/.khunquant/.security.yml:
channels:
slack:
bot_token: "xoxb-..."
app_token: "xapp-..."
| Field | Type | Description |
|---|---|---|
enabled | bool | Enable the Slack channel |
bot_token | SecureString | Bot User OAuth Token (xoxb-) for sending messages |
app_token | SecureString | App-Level Token (xapp-) for Socket Mode connection |
allow_from | []string | Allowlist of Slack user IDs (empty allows all) |
group_trigger.mention_only | bool | Only respond in channels when the bot is @mentioned |
typing.enabled | bool | Show typing indicator while generating a response |
placeholder.enabled | bool | Post a temporary placeholder while processing |
placeholder.text | string | Text of the placeholder message |
reasoning_channel_id | string | Channel ID for streaming reasoning output separately |
Setup steps
-
Go to api.slack.com/apps and click Create New App → From scratch.
-
Under Settings → Socket Mode, enable Socket Mode and generate an App-Level Token with the
connections:writescope. Copy the token (xapp-). -
Under OAuth & Permissions → Bot Token Scopes, add the following scopes:
Scope Purpose chat:writeSend messages im:historyRead DM history im:readAccess DM channels reactions:writeAdd emoji reactions files:writeUpload files channels:historyRead channel messages app_mentions:readDetect @mentions -
Click Install to Workspace and copy the Bot User OAuth Token (
xoxb-). -
Under Event Subscriptions, enable events and subscribe to:
message.im,message.channels, andapp_mention. -
Add both tokens to
.security.yml. -
Start KhunQuant.
In Slack, click your profile photo → Profile → the three-dot menu → Copy member ID. Use this value in allow_from.
Responses exceeding Slack's character limit are automatically split across multiple messages so no content is truncated.