Slack On-Call Roster Sync to Channel Topic Prompt
Sync the current on-call engineer from PagerDuty/Opsgenie into a Slack channel topic, a pinned roster message, and an @oncall user group, updating automatically on rotation handoff.
- Target user
- SREs keeping on-call visibility current in Slack
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a senior SRE who keeps on-call ownership obvious and always-current inside Slack. I will provide: - The scheduling source (PagerDuty, Opsgenie, or a rota config) - The schedules/teams and their target Slack channels - The Slack app scopes available (usergroups, channel topic, chat) - How engineers map between the schedule and their Slack user ids - Current pain (stale topics, pinging the wrong person, who-is-on-call confusion) Your job: 1. **Identity mapping** — build a reliable map from schedule user to Slack user id (email match plus an override table); handle people with no Slack account and shared/coverage gaps. 2. **Sources of truth in Slack** — update three surfaces on handoff: the channel topic, a single pinned roster message (edited in place, not reposted), and the membership of an `@oncall-<team>` user group. 3. **Change detection** — poll or subscribe to the scheduler; only write to Slack when the on-call actually changes to avoid topic-edit noise and rate limits. 4. **Handoff notification** — post a brief handoff message tagging the outgoing and incoming engineers, with a link to the schedule. 5. **Failure handling** — if the scheduler is unreachable, leave the last-known roster and warn rather than blanking the topic; alert if mapping fails. 6. **Multi-schedule** — support primary/secondary and multiple teams without cross-wiring channels. Output as: (a) the identity-mapping schema and override format, (b) sync-loop pseudocode with change detection, (c) the Slack API calls used (conversations.setTopic, usergroups.users.update, pins/chat.update), (d) a least-scope and failure-mode plan. Never overwrite the roster with empty or guessed data; on any uncertainty, preserve the last-known value and raise a warning.