Build · A Slack channel digest bot
A bot that posts a daily summary to a Slack channel. Real API tokens, real scheduling. ~25 min.
You'll build a real Slack bot that posts a daily channel summary. Different shape than the existing builds: this one uses two API tokens (Slack + an LLM), reads real channel data, and gets scheduled.
Create a Slack app + bot user
Once-per-bot setup. Skip if you've done this before.
- Create New App → From scratch. Name it (e.g. "Daily Digest").
- Pick the workspace you want it in. Apps can be created in a personal workspace first; install in others later.
- Under OAuth & Permissions, add these Bot Token Scopes:
channels:history— read public channel messageschat:write— post messages
- Click Install to Workspace. Approve.
You see a Bot User OAuth Token starting with xoxb-. Copy it.
Add the bot to a channel
The bot can only read channels it's a member of. In your test channel, type /invite @Daily Digest (or whatever you named it).
Slack confirms: "added Daily Digest to #channel".
Get the channel ID
In Slack, right-click the channel name → View channel details. The ID at the bottom looks like C0123ABC456.
Make a project folder + .env file
mkdir ~/slack-digest && cd ~/slack-digest cat > .env <<'EOF' SLACK_BOT_TOKEN=xoxb-...your-token... ANTHROPIC_API_KEY=sk-ant-... EOF echo ".env" > .gitignore
Folder exists. .env is gitignored (never commit it).
Open your coding CLI and paste the build prompt
Run claude / codex / aider in the folder. Paste:
Write a Node.js script bot.js that:
- Reads SLACK_BOT_TOKEN and ANTHROPIC_API_KEY from env (.env via dotenv).
- Fetches the last 24h of messages from a channel ID passed as arg.
- Use https://slack.com/api/conversations.history with limit=200, oldest=<24h ago>
- Auth via Authorization: Bearer ${SLACK_BOT_TOKEN}
- Calls Claude with the messages joined by newlines, system prompt:
"You are a TL;DR bot. Read this Slack channel transcript and produce a 3-bullet summary suitable
for posting back to the channel. Each bullet starts with an emoji. Keep it under 80 words."
- Posts the summary to the same channel via chat.postMessage.
Single file. dotenv + node:18 fetch. No frameworks. Print every Slack API response so I can see failures.
Then add a package.json with a "start" script. Run with: node bot.js C123ABC456 (a channel id). Approve the writes and the install
The CLI will:
- Write
bot.js(~80 lines) - Write
package.jsonwith the@anthropic-ai/sdk+dotenvdeps - Run
npm install— allow it
Done in ~30 seconds. node bot.js C0123ABC456 runs without crashing.
Test it
Run on your test channel:
node bot.js C0123ABC456
The bot posts a 3-bullet summary to the channel within a few seconds. If you see an error, paste it back to the CLI — it'll diagnose. Common gotchas: not_in_channel (re-invite the bot), missing_scope (check OAuth scopes).
Add --dry-run
Iterate in the CLI:
Add a --dry-run flag. When set, print the summary to stdout instead of posting it. Useful for testing before pointing it at a real channel.
node bot.js C0123ABC456 --dry-run prints to stdout, doesn't post.
Schedule it (pick one path)
Ask the CLI for the three scheduling options:
Show me three ways to schedule this for daily 9am runs: 1. macOS launchd (plist) 2. Linux cron (crontab line) 3. A GitHub Actions workflow that runs on schedule and pipes the SLACK_BOT_TOKEN from a secret For each, show the exact file or command I'd run.
Recommended: GitHub Actions if you want zero machines to manage; cron if you have a server already; launchd if you only need it while your Mac is on.
The bot posts a daily summary at 9am without you doing anything.
Tool is yours to keep. Come back any time — your progress is saved.