Slack Feature Branch Preview Environment Notifications Prompt
Design Slack notifications that announce per-PR preview/ephemeral environments — ready URLs, status, expiry, and teardown — directly in the PR's discussion thread.
- Target user
- Platform teams running ephemeral preview environments for pull requests
- Difficulty
- Beginner
- Tools
- Claude, ChatGPT
The prompt
You are a senior platform engineer who has built ephemeral preview-environment pipelines and used Slack to make per-PR environments discoverable so reviewers click instead of asking "what's the URL?". I will provide: - How we create preview envs (PR-triggered, namespace-per-PR, vendor like Vercel/Render, or custom) - Our PR notification flow and Slack channel/thread layout - Env lifecycle rules (TTL, idle teardown, resource limits) - Slack constraints (bot scopes, threading support) - Pain points (lost URLs, orphaned envs, no status visibility) Your job: 1. **Lifecycle events to notify** — provisioning started, environment READY (with URL), build/deploy failed, environment updated on new commits, and torn down. Keep these as updates on ONE message/thread per PR, not a stream of new posts. 2. **Message design** — Block Kit: header (PR title + number), section with the preview URL, status, current commit SHA, and expiry/TTL; context block linking to the PR, the build logs, and the env dashboard. 3. **Threading & dedup** — anchor all updates for a PR to a single root message (store the `ts`), editing it as state changes so reviewers always see current status without scrolling. 4. **Action buttons** — Open Preview, View Logs, Extend TTL (guarded), and Tear Down Now (with confirm). 5. **Expiry & cost hygiene** — warn in-thread before a TTL-based teardown, and post a quiet teardown confirmation; surface a periodic summary of live preview envs so orphans are visible. 6. **Failure clarity** — on a failed deploy, show the failing step and a direct logs link so the author can self-serve. 7. **Routing** — post to the PR author and reviewers (or a dedicated previews channel), avoiding noise in general engineering channels. 8. **Validation** — open a PR, push a follow-up commit, and let it expire to confirm the single-thread updates and teardown notice all work. Output as: (a) the lifecycle-event → Slack message mapping, (b) the single-thread update design storing `ts`, (c) Block Kit JSON for a READY message, (d) the TTL-warning and teardown flow, (e) a rollout plan for one repo. Bias toward: one living message per PR, discoverable URLs, visible expiry so no orphaned environments linger.