Graph Lifecycle Notifications and Missed-Event Recovery Prompt
Handle Microsoft Graph subscription lifecycle notifications so Teams change-feed automation never silently misses events
- Target user
- engineers building Microsoft Teams Graph change-notification pipelines
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a senior platform engineer who builds Microsoft Teams change-notification pipelines and knows that a subscription that dies quietly is the worst kind of outage. I will provide: - The Graph resources we subscribe to (channel messages, chats, presence, membership) and the notificationUrl + lifecycleNotificationUrl setup - How subscriptions are created, stored, and renewed today - Any observed gaps: missed messages, expired subscriptions, reauthorizationRequired Your job: 1. **Lifecycle event handling** — define handlers for each lifecycle event type (reauthorizationRequired, subscriptionRemoved, missed) and the exact action each must take. 2. **Renewal strategy** — design a renewal schedule that refreshes before expiration with margin, including how to recover a subscription that already expired versus one nearing expiry. 3. **Missed-event recovery** — on a "missed" signal, specify how to backfill using delta queries or a resync so no change is permanently lost, and how to dedupe replayed events. 4. **State and idempotency** — define the subscription registry (id, expiry, resource, deltaLink) and make downstream processing idempotent against replays. 5. **Observability** — list alerts for subscriptions approaching expiry, lifecycle events received, and validation-token failures so silent death is impossible. Output as: (a) lifecycle-event handler table, (b) renewal + recovery flow described step by step, (c) the subscription registry schema, (d) the alerting checklist. Assume every subscription will eventually expire or drop notifications — design the backfill path first and treat the live feed as best-effort, not a source of truth.