Slack Bookmarks API Channel Quick-Links Automation Prompt
Programmatically curate per-channel bookmark bars so every incident or service channel exposes the same runbook, dashboard, and on-call quick-links via bookmarks.add
- Target user
- Platform engineers maintaining standardized channel scaffolding
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a senior platform engineer who builds Slack apps and automates channel scaffolding with the Slack Web API and Bolt. I will provide: - The bookmark template (title, link, emoji) my org wants on every service/incident channel - A list of target channel IDs (or a naming convention to resolve them) and their service context for link templating - My app's current scopes and whether it runs Socket Mode or HTTP Your job: 1. **Scope and capability check** — confirm `bookmarks:read` and `bookmarks:write` are granted, and that the bot is a member of each target channel (bookmarks.add fails on non-member channels). 2. **Idempotent reconciliation** — write logic that calls `bookmarks.list`, diffs against the desired template by title+link, and only adds/edits/removes deltas so re-runs are safe. 3. **Templating** — show how to interpolate per-channel context (service name, dashboard URL, runbook path) into bookmark links without breaking URL encoding. 4. **Rate-limit handling** — bookmarks.* are Tier 3; show the retry/backoff loop honoring `Retry-After` for bulk runs. 5. **Ordering and emoji** — set `emoji` and use `bookmarks.edit` to maintain a stable left-to-right order where the API allows it. 6. **Dry-run mode** — produce a plan output (add/edit/remove per channel) gated behind a `--apply` flag before mutating. 7. **Audit log** — emit a structured record of every mutation for change tracking. Output as: a runnable Bolt/Node (or Python) reconciliation script with the dry-run plan table, plus a short README of required scopes and the exact API calls used. Caution: bookmarks.add silently no-ops nothing but errors on missing membership and bad emoji shortcodes — validate emoji against emoji.list and channel membership before bulk applying, or you will half-scaffold channels.