Teams Bot Throttling & Retry Resilience Prompt
Design a Teams bot that survives Bot Framework and Graph 429 throttling — honoring Retry-After, batching proactive sends, and applying jittered backoff so incident-storm notification bursts never get dropped.
- Target user
- Backend engineers running high-volume Teams bots in production
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a senior backend engineer who has run Teams bots that fan out thousands of proactive messages during incidents without getting throttled into silence. I will provide: - The bot's send patterns (per-conversation, per-tenant, broadcast) - Peak burst volume during an incident storm - Current SDK (Bot Framework JS/.NET) and hosting (Functions, App Service, AKS) - Observed throttling symptoms and current retry logic (if any) Your job: 1. **Map the throttling surfaces** — distinguish Bot Connector service limits (per-bot, per-conversation, per-thread message rate) from Microsoft Graph limits (per-app, per-tenant, per-resource). Note that each returns 429 with a `Retry-After` header that you MUST honor rather than guessing. 2. **Backoff policy** — specify exponential backoff with full jitter, a cap, and a hard attempt ceiling. Prefer the server's `Retry-After` over your computed delay whenever present. Show the formula and a worked example for a 5-attempt sequence. 3. **Proactive send architecture** — put outbound messages on a queue (Service Bus / Storage Queue) with a single-flight worker pool that respects a token-bucket rate limiter per conversation and per tenant. Explain why direct fan-out from a webhook handler guarantees throttling. 4. **Graph batching** — use the `$batch` endpoint (max 20 requests) to collapse roster lookups and avoid per-user calls; handle partial 429s inside a batch response independently. 5. **Idempotency & dedup** — attach an idempotency key so retries after ambiguous failures don't double-post; dedup by (conversationId, alertId). 6. **Circuit breaking & shedding** — when sustained 429s exceed a threshold, open a breaker, collapse N alerts into one digest card, and surface a degraded-mode banner instead of dropping silently. 7. **Observability** — emit metrics for 429 rate, Retry-After distribution, queue depth, and send latency p99; alert when the breaker opens. Output as: (a) the queue + worker + rate-limiter design diagram-in-text, (b) backoff pseudocode honoring Retry-After, (c) a `$batch` example with partial-failure handling, (d) the metrics/alerts list, (e) a load-test plan that simulates an incident storm. Bias toward: queues over direct sends, honoring server hints over clever math, degrading loudly over failing silently.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
Teams Proactive App Install for Users via Graph Prompt
Programmatically install a Teams app for a list of users via Graph so a bot can proactively message them — fetching the conversation reference without waiting for the user to find the app.
-
Microsoft Graph Rate-Limit Budget Planning Prompt
Design a request budget and backoff strategy so Teams Graph automation stays under per-app and per-tenant throttling limits
-
Teams Bot File Attachment Handling for Log Bundles Prompt
Design a Teams bot that accepts dropped log bundles / diagnostics, validates and stores them, and returns analysis — handling both personal-chat file consent and channel file references via Graph.
-
Teams Proactive Bot Messaging at Scale Prompt
Design reliable proactive (bot-initiated) Teams messaging at scale — capturing conversation references, app installation via Graph, throttling, retries, and per-user/per-channel delivery without spam.
More Microsoft Teams prompts & error guides
Browse every Microsoft Teams prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.