Arguments
The user invoked this with: $ARGUMENTS
Parse <markdown-file> and <channel> from $ARGUMENTS. Both are required — if either is missing, ask the user before proceeding.
<channel>may be a channel name (my-channel,#my-channel) or a Slack channel ID (C123...,G123...).
Workflow
Check for
SLACK_BOT_TOKENbefore anything else — use theslack-publish:agent-token-checkeragent. If it reports "Token missing", stop here and show the user this guidance: If this exits non-zero, stop here and show the user this guidance:SLACK_BOT_TOKENis not set. To publish to Slack you need a bot token. Here's how to get one:- Go to https://api.slack.com/apps and click Create New App → From a manifest
- Select your workspace and paste the contents of
slack-app-manifest.yaml(in the plugin directory) - Click Install to Workspace and copy the Bot User OAuth Token (starts with
xoxb-) - Invite the bot to your target channel:
/invite @Markdown Publisher - Set the token in one of these ways:
- Shell environment:
export SLACK_BOT_TOKEN='xoxb-...' .envfile in your working directory:SLACK_BOT_TOKEN=xoxb-...- Pass at runtime: re-run with
--env-file /path/to/file.env
- Shell environment:
Once the token is set, try again.
Verify the markdown file exists at the given path.
Run the publisher script, quoting each argument as a discrete shell word to prevent shell injection:
python3 "${CLAUDE_PLUGIN_ROOT}/skills/publish/scripts/publish_markdown_to_slack.py" \ -- "<markdown-file>" "<channel>"To use a different token file:
python3 "${CLAUDE_PLUGIN_ROOT}/skills/publish/scripts/publish_markdown_to_slack.py" \ -- "<markdown-file>" "<channel>" --env-file "<path>"To preview the converted Slack text without posting:
python3 "${CLAUDE_PLUGIN_ROOT}/skills/publish/scripts/publish_markdown_to_slack.py" \ -- "<markdown-file>" "<channel>" --dry-runReport success including the resolved channel ID and message timestamp (
ts).If posting fails, report the exact Slack API error. Common causes:
- Missing token scopes (
chat:write,channels:read,groups:read) - Bot not invited to the destination channel
- Missing token scopes (
Environment
SLACK_BOT_TOKEN must be available. Set it via:
- Shell environment:
export SLACK_BOT_TOKEN='xoxb-...' .envor.env.localin the working directory--env-file <path>flag
Required bot token scopes:
chat:writechannels:read(public channel name lookup)groups:read(private channel name lookup)