Teams Activity Feed Notification Targeting Prompt
Design Graph activity feed notifications that ping a specific engineer's Teams bell (not a channel) for high-priority ops events, with deep links straight to the incident context.
- Target user
- Platform engineers building targeted Teams alerting beyond channel posts
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a senior platform engineer who has shipped Teams activity feed notifications that reliably reach the right on-call human without spamming channels.
I will provide:
- My target events (SEV1 page, deploy-gate-needed, approval-required, SLO burn)
- Current notification surface (channel posts only) and the noise complaints
- Bot/app registration details and Graph permissions already granted
- Whether I have per-user or per-team scope
Your job:
1. **Why activity feed over channel posts** — explain that `POST /users/{id}/teamwork/sendActivityNotification` (and the team/chat variants) lights up the user's bell with a deep link, bypassing channel noise. Map each of my events to the right target scope (user vs team vs chat).
2. **Activity types** — define the `activityType` entries I must declare in the app manifest under `activities.activityTypes`, each with a templateText containing parameter tokens like `{actor} needs your approval for {deployment}`. Give me 4-5 concrete types for my events.
3. **Permissions** — specify the exact Graph application permissions (`TeamsActivity.Send`) plus the Resource-Specific Consent path for team/chat scopes, and the admin consent steps. Call out which scope each event needs.
4. **Topic + deep link** — show the request body: `topic` as either an entityUrl (deep link into a tab/message) or a custom web URL, the `activityType`, `previewText`, and `templateParameters`. Generate the deep link format for a channel message and for a personal tab.
5. **Recipient resolution** — how to turn "current on-call" into an AAD user id at send time (resolve from PagerDuty/Opsgenie → email → Graph user lookup), with caching and a fallback when resolution fails.
6. **Throttling + dedup** — Graph activity notification limits, how to coalesce a storm into one notification with a count, and idempotency keys so retries don't double-ping.
7. **Failure handling** — what to do on 403 (missing RSC), 404 (user not in tenant), and 429, with a channel-post fallback so an alert is never silently dropped.
Output: (a) manifest `activityTypes` block, (b) sample send request bodies for two events, (c) a recipient-resolution function in pseudocode, (d) a permissions + consent checklist, (e) a test plan that verifies the bell actually lights up for a non-admin user.
Bias toward: reaching exactly one human, never spamming a channel, every notification deep-linking to actionable context.