/slack-channel:configure
Overview
Configure the Slack channel with its bot and app-level tokens. This is the only
token-writing path: validate prefixes, write .env with owner-only
permissions, never echo secrets, and return control to the install walkthrough.
Prerequisites
- A Slack app already created (via
/slack-channel:install Step 1 or
manually at api.slack.com/apps) with:
- the Bot User OAuth Token (
xoxb-...) from OAuth & Permissions, and
- the App-Level Token (
xapp-..., scope connections:write) from
Socket Mode settings.
- A writable home directory — state lives at
~/.claude/channels/slack/.
Usage
Pass both tokens as arguments, bot token first. Obtain them directly from the
Slack app dashboard and avoid shell history or shared transcripts:
/slack-channel:configure <xoxb-bot-token> <xapp-app-token>
Authentication
- The
xoxb- Bot User OAuth Token represents the installed bot and authorizes
Web API calls within its granted bot scopes.
- The
xapp- app-level token represents the Slack app and requires
connections:write to open the Socket Mode WebSocket.
- Prefix checks establish token type, not validity.
install doctor verifies
liveness against Slack without printing the credential.
- Store tokens only in
~/.claude/channels/slack/.env; never commit them or
include them in output, logs, screenshots, or issue reports.
Read references/official-auth.md when creating,
rotating, revoking, or diagnosing either token type.
Instructions
Parse the two arguments from $ARGUMENTS:
- First token must start with
xoxb- (Bot User OAuth Token)
- Second token must start with
xapp- (App-Level Token)
If either token is missing or has the wrong prefix, show this error and stop:
Error: Two tokens required.
- Bot token (starts with xoxb-) from OAuth & Permissions
- App token (starts with xapp-) from Socket Mode settings
Usage: /slack-channel:configure xoxb-... xapp-...
Create the state directory if it doesn't exist, then make the directory
owner-only before writing any secret-bearing file:
mkdir -p ~/.claude/channels/slack
# 0700 = owner may read/write/traverse; no group or other access
chmod 700 ~/.claude/channels/slack
Pre-create the fixed candidate path with owner-only permissions, then use
Write to replace its complete contents. This makes the file 0600 from
the instant it exists, independent of the process umask:
# 0600 = owner read/write; no group or other access
install -m 600 /dev/null ~/.claude/channels/slack/.env.tmp
Write this complete content to ~/.claude/channels/slack/.env.tmp:
SLACK_BOT_TOKEN=<bot-token>
SLACK_APP_TOKEN=<app-token>
Set the candidate file to owner-only, then atomically replace .env. If
Write, chmod, or mv fails before replacement, remove only the exact
candidate path ~/.claude/channels/slack/.env.tmp; leave the prior .env
untouched.
# 0600 = owner read/write; no group or other access
chmod 600 ~/.claude/channels/slack/.env.tmp
mv ~/.claude/channels/slack/.env.tmp ~/.claude/channels/slack/.env
Confirm success:
Slack channel configured.
Start Claude with the Slack channel:
claude --channels plugin:slack-channel@claude-code-plugins
Or for development:
claude --dangerously-load-development-channels server:slack
Next: opt in a channel and pick its interaction mode with
/slack-channel:access channel <id> (defaults to mention-to-engage;
pass --ambient for a dedicated bot channel). See ACCESS.md "Interaction modes".
Output
- On success:
~/.claude/channels/slack/.env atomically replaced with both
tokens and mode 0600, plus the confirmation block above (server start
command and the pointer to channel opt-in). Tokens are never echoed.
- On failure: the two-token usage error from step 2 and no file changes.
Error Handling
- Missing token or wrong prefix — show the step-2 error block and stop;
nothing is written. Bot tokens must start with
xoxb-, app tokens with
xapp-.
- Tokens swapped — the prefix check catches it; re-run with the bot token
first.
- Existing
.env — re-running atomically replaces it; this is the
supported token-rotation path (rotation happens at api.slack.com/apps).
- Write, permission, or move failure — remove only the fixed candidate
~/.claude/channels/slack/.env.tmp, leave the previous .env intact, and
report only the failed stage without printing values.
- Revoked/invalid tokens — this skill only validates prefixes, not
liveness. If the server later fails auth, run
/slack-channel:install doctor (checks 4–5 test both tokens live against
the Slack API).
Examples
Both flows are the same command — the second run simply overwrites .env:
# First-time setup (illustrative placeholders, not live credentials)
/slack-channel:configure xoxb-WORKSPACE-EXAMPLE xapp-APP-EXAMPLE
# Rotation after regenerating tokens in the Slack UI — same command, overwrites .env
/slack-channel:configure xoxb-NEW-TOKEN xapp-NEW-TOKEN
Security
- Never echo the tokens back in the confirmation message
- Never log tokens to stdout or any file other than
.env
- Secure the state directory as
0700 before writing the candidate
- Always set
0600 on the candidate before atomically moving it into place
Safety justification
rm is permitted only to clean the single fixed candidate path
~/.claude/channels/slack/.env.tmp after a failed rotation. Never pass a
variable, glob, directory, recursive flag, or any other path to rm; never
remove the previous .env.
Resources
skills/install/SKILL.md — the full install lifecycle that delegates to this skill (Step 3) and the doctor that verifies token liveness
skills/access/SKILL.md — the next step after configuring: channel opt-in and pairing
ACCESS.md — interaction modes referenced in the confirmation message
README.md — quick start, including Node.js and Docker server alternatives
1---2name: configure-33description: Configure Slack channel tokens (bot token + app-level token). Use when writing or rotating the Slack bot and app-level tokens for the slack-channel plugin. Trigger with "/slack-channel:configure", "configure slack tokens", or "set up my slack bot token".4version: 1.1.05author: Jeremy Longshore <jeremy@intentsolutions.io>6license: Apache-2.07compatibility: Requires Claude Code with the slack-channel plugin and a Slack app that already exists (tokens come from api.slack.com/apps); POSIX shell for chmod/mkdir.8tags: [slack, tokens, configuration, security]9user-invocable: true10argument-hint: "<bot-token> <app-token>"11allowed-tools: [Write, "Bash(chmod:*)", "Bash(install:*)", "Bash(mkdir:*)", "Bash(mv:*)", "Bash(rm:*)"]12model: inherit13effort: medium14metadata:15 source: https://skillmd.com/skills/jeremylongshore/configure-316---1718# /slack-channel:configure1920## Overview2122Configure the Slack channel with its bot and app-level tokens. This is the only23token-writing path: validate prefixes, write `.env` with owner-only24permissions, never echo secrets, and return control to the install walkthrough.2526## Prerequisites2728- A Slack app already created (via `/slack-channel:install` Step 1 or29 manually at api.slack.com/apps) with:30 - the **Bot User OAuth Token** (`xoxb-...`) from **OAuth & Permissions**, and31 - the **App-Level Token** (`xapp-...`, scope `connections:write`) from32 **Socket Mode** settings.33- A writable home directory — state lives at `~/.claude/channels/slack/`.3435## Usage3637Pass both tokens as arguments, bot token first. Obtain them directly from the38Slack app dashboard and avoid shell history or shared transcripts:3940```41/slack-channel:configure <xoxb-bot-token> <xapp-app-token>42```4344## Authentication4546- The `xoxb-` Bot User OAuth Token represents the installed bot and authorizes47 Web API calls within its granted bot scopes.48- The `xapp-` app-level token represents the Slack app and requires49 `connections:write` to open the Socket Mode WebSocket.50- Prefix checks establish token type, not validity. `install doctor` verifies51 liveness against Slack without printing the credential.52- Store tokens only in `~/.claude/channels/slack/.env`; never commit them or53 include them in output, logs, screenshots, or issue reports.5455Read [`references/official-auth.md`](references/official-auth.md) when creating,56rotating, revoking, or diagnosing either token type.5758## Instructions59601. Parse the two arguments from `$ARGUMENTS`:61 - First token must start with `xoxb-` (Bot User OAuth Token)62 - Second token must start with `xapp-` (App-Level Token)63642. If either token is missing or has the wrong prefix, show this error and stop:6566 ```67 Error: Two tokens required.68 - Bot token (starts with xoxb-) from OAuth & Permissions69 - App token (starts with xapp-) from Socket Mode settings7071 Usage: /slack-channel:configure xoxb-... xapp-...72 ```73743. Create the state directory if it doesn't exist, then make the directory75 owner-only **before writing any secret-bearing file**:7677 ```bash78 mkdir -p ~/.claude/channels/slack79 # 0700 = owner may read/write/traverse; no group or other access80 chmod 700 ~/.claude/channels/slack81 ```82834. Pre-create the fixed candidate path with owner-only permissions, then use84 `Write` to replace its complete contents. This makes the file `0600` from85 the instant it exists, independent of the process umask:8687 ```bash88 # 0600 = owner read/write; no group or other access89 install -m 600 /dev/null ~/.claude/channels/slack/.env.tmp90 ```9192 Write this complete content to `~/.claude/channels/slack/.env.tmp`:9394 ```95 SLACK_BOT_TOKEN=<bot-token>96 SLACK_APP_TOKEN=<app-token>97 ```98995. Set the candidate file to owner-only, then atomically replace `.env`. If100 `Write`, `chmod`, or `mv` fails before replacement, remove only the exact101 candidate path `~/.claude/channels/slack/.env.tmp`; leave the prior `.env`102 untouched.103104 ```bash105 # 0600 = owner read/write; no group or other access106 chmod 600 ~/.claude/channels/slack/.env.tmp107 mv ~/.claude/channels/slack/.env.tmp ~/.claude/channels/slack/.env108 ```1091106. Confirm success:111 ```112 Slack channel configured.113114 Start Claude with the Slack channel:115 claude --channels plugin:slack-channel@claude-code-plugins116117 Or for development:118 claude --dangerously-load-development-channels server:slack119120 Next: opt in a channel and pick its interaction mode with121 /slack-channel:access channel <id> (defaults to mention-to-engage;122 pass --ambient for a dedicated bot channel). See ACCESS.md "Interaction modes".123 ```124125## Output126127- On success: `~/.claude/channels/slack/.env` atomically replaced with both128 tokens and mode `0600`, plus the confirmation block above (server start129 command and the pointer to channel opt-in). Tokens are never echoed.130- On failure: the two-token usage error from step 2 and no file changes.131132## Error Handling133134- **Missing token or wrong prefix** — show the step-2 error block and stop;135 nothing is written. Bot tokens must start with `xoxb-`, app tokens with136 `xapp-`.137- **Tokens swapped** — the prefix check catches it; re-run with the bot token138 first.139- **Existing `.env`** — re-running atomically replaces it; this is the140 supported token-rotation path (rotation happens at api.slack.com/apps).141- **Write, permission, or move failure** — remove only the fixed candidate142 `~/.claude/channels/slack/.env.tmp`, leave the previous `.env` intact, and143 report only the failed stage without printing values.144- **Revoked/invalid tokens** — this skill only validates prefixes, not145 liveness. If the server later fails auth, run146 `/slack-channel:install doctor` (checks 4–5 test both tokens live against147 the Slack API).148149## Examples150151Both flows are the same command — the second run simply overwrites `.env`:152153```154# First-time setup (illustrative placeholders, not live credentials)155/slack-channel:configure xoxb-WORKSPACE-EXAMPLE xapp-APP-EXAMPLE156157# Rotation after regenerating tokens in the Slack UI — same command, overwrites .env158/slack-channel:configure xoxb-NEW-TOKEN xapp-NEW-TOKEN159```160161## Security162163- Never echo the tokens back in the confirmation message164- Never log tokens to stdout or any file other than `.env`165- Secure the state directory as `0700` before writing the candidate166- Always set `0600` on the candidate before atomically moving it into place167168## Safety justification169170`rm` is permitted only to clean the single fixed candidate path171`~/.claude/channels/slack/.env.tmp` after a failed rotation. Never pass a172variable, glob, directory, recursive flag, or any other path to `rm`; never173remove the previous `.env`.174175## Resources176177- [`skills/install/SKILL.md`](https://github.com/jeremylongshore/claude-code-slack-channel/blob/main/skills/install/SKILL.md) — the full install lifecycle that delegates to this skill (Step 3) and the doctor that verifies token liveness178- [`skills/access/SKILL.md`](https://github.com/jeremylongshore/claude-code-slack-channel/blob/main/skills/access/SKILL.md) — the next step after configuring: channel opt-in and pairing179- [`ACCESS.md`](https://github.com/jeremylongshore/claude-code-slack-channel/blob/main/ACCESS.md) — interaction modes referenced in the confirmation message180- [`README.md`](https://github.com/jeremylongshore/claude-code-slack-channel/blob/main/README.md) — quick start, including Node.js and Docker server alternatives