[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-twilio-twilio-reliability-patterns":3,"mdc-qjbqwz-key":33,"related-repo-twilio-twilio-reliability-patterns":2078,"related-org-twilio-twilio-reliability-patterns":2186},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":23,"repoUrl":24,"updatedAt":25,"license":26,"forks":27,"topics":28,"repo":29,"sourceUrl":31,"mdContent":32},"twilio-reliability-patterns","implement Twilio reliability and retry patterns","Handle rate limits, retries, and failures when building on Twilio at scale. Covers 429 exponential backoff with jitter, per-number throughput limits, StatusCallback resilience, thin-receiver pattern, and fallback chains. Use this skill whenever sending messages or making calls at volume, or when building production-grade Twilio integrations.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},"twilio","Twilio","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Ftwilio.png",[12,16,19,22],{"name":13,"slug":14,"type":15},"Performance","performance","tag",{"name":17,"slug":18,"type":15},"Automation","automation",{"name":20,"slug":21,"type":15},"API Development","api-development",{"name":9,"slug":8,"type":15},25,"https:\u002F\u002Fgithub.com\u002Ftwilio\u002Fai","2026-07-17T06:06:23.782883",null,7,[],{"repoUrl":24,"stars":23,"forks":27,"topics":30,"description":26},[],"https:\u002F\u002Fgithub.com\u002Ftwilio\u002Fai\u002Ftree\u002FHEAD\u002Fskills\u002Ftwilio\u002Ftwilio-reliability-patterns","---\nname: twilio-reliability-patterns\ndescription: >\n  Handle rate limits, retries, and failures when building on Twilio at\n  scale. Covers 429 exponential backoff with jitter, per-number throughput\n  limits, StatusCallback resilience, thin-receiver pattern, and fallback\n  chains. Use this skill whenever sending messages or making calls at\n  volume, or when building production-grade Twilio integrations.\n---\n\n## Overview\n\nTwilio enforces per-resource rate limits. At scale, 429 errors are expected behavior — not bugs. This skill teaches the patterns that prevent production failures: exponential backoff, throughput management, and resilient callback handling.\n\n429 concurrency errors are not well documented — implement exponential backoff with ±10% jitter.\n\n---\n\n## Prerequisites\n\n- A working Twilio integration (any product)\n- Understanding of your expected volume (messages\u002Fsec, calls\u002Fsec)\n- StatusCallback URLs configured — see `twilio-messaging-services`, `twilio-sms-send-message`\n\n---\n\n## Key Patterns\n\n### 1. Exponential Backoff with Jitter\n\nWhen you receive a 429 (Too Many Requests), wait and retry. Naive fixed-interval retry creates thundering herds. Use exponential backoff with randomized jitter.\n\n**Python**\n```python\nimport time, random, requests\n\ndef send_with_backoff(client, to, body, messaging_service_sid, max_retries=5):\n    for attempt in range(max_retries):\n        try:\n            message = client.messages.create(\n                to=to,\n                body=body,\n                messaging_service_sid=messaging_service_sid,\n                status_callback=\"https:\u002F\u002Fyourapp.com\u002Fstatus\"\n            )\n            return message\n        except Exception as e:\n            if hasattr(e, 'status') and e.status == 429:\n                # Exponential backoff: 100ms, 200ms, 400ms, 800ms, 1600ms\n                base_delay = 0.1 * (2 ** attempt)\n                # Add ±10% jitter to prevent thundering herd\n                jitter = base_delay * 0.1 * (2 * random.random() - 1)\n                delay = min(base_delay + jitter, 30)  # cap at 30 seconds\n                time.sleep(delay)\n            else:\n                raise  # Non-429 errors: don't retry, investigate\n    raise Exception(f\"Failed after {max_retries} retries\")\n```\n\n**Node.js**\n```node\nasync function sendWithBackoff(client, to, body, messagingServiceSid, maxRetries = 5) {\n    for (let attempt = 0; attempt \u003C maxRetries; attempt++) {\n        try {\n            return await client.messages.create({\n                to,\n                body,\n                messagingServiceSid,\n                statusCallback: \"https:\u002F\u002Fyourapp.com\u002Fstatus\",\n            });\n        } catch (err) {\n            if (err.status === 429) {\n                \u002F\u002F Exponential backoff: 100ms, 200ms, 400ms, 800ms, 1600ms\n                const baseDelay = 100 * Math.pow(2, attempt);\n                \u002F\u002F Add ±10% jitter\n                const jitter = baseDelay * 0.1 * (2 * Math.random() - 1);\n                const delay = Math.min(baseDelay + jitter, 30000); \u002F\u002F cap at 30s\n                await new Promise(r => setTimeout(r, delay));\n            } else {\n                throw err; \u002F\u002F Non-429: don't retry\n            }\n        }\n    }\n    throw new Error(`Failed after ${maxRetries} retries`);\n}\n```\n\n**Parameters:**\n- Initial delay: 100ms\n- Multiplier: 2x per attempt\n- Jitter: ±10% of base delay (randomized)\n- Max delay: 30 seconds\n- Max retries: 5 (covers up to ~3.2 second base delay)\n\n### 2. Per-Number Throughput Limits\n\nThese limits are not prominently documented:\n\n| Number type | SMS throughput | Voice throughput | Notes |\n|-------------|---------------|-----------------|-------|\n| Local (long code) | ~1 SMS\u002Fsec | 1 concurrent call | Lowest cost, lowest throughput |\n| Toll-free | ~3 SMS\u002Fsec | — | Faster verification (3-5 days) |\n| Short code | 10-100 SMS\u002Fsec | — | Highest throughput, 8-12 week provisioning, expensive |\n| Messaging Service (pool) | Sum of all numbers in pool | — | Multiply throughput by adding numbers |\n\n**Throughput opacity:** Sending velocity and queue depth are opaque — there is no dashboard showing messages per second. Use Messaging Services to multiply throughput by pooling numbers. A pool of 10 long codes = ~10 SMS\u002Fsec.\n\n### 3. Bulk Send Pattern\n\nFor sending to large lists, use a rate-limited dispatch loop:\n\n**Python**\n```python\nimport asyncio\nfrom collections import deque\n\nasync def bulk_send(client, recipients, body, messaging_service_sid, rate_per_second=10):\n    \"\"\"Send to a list of recipients with rate limiting and backoff.\"\"\"\n    queue = deque(recipients)\n    results = []\n    \n    while queue:\n        batch = []\n        for _ in range(min(rate_per_second, len(queue))):\n            batch.append(queue.popleft())\n        \n        for recipient in batch:\n            try:\n                msg = send_with_backoff(client, recipient, body, messaging_service_sid)\n                results.append({\"to\": recipient, \"sid\": msg.sid, \"status\": \"sent\"})\n            except Exception as e:\n                results.append({\"to\": recipient, \"error\": str(e), \"status\": \"failed\"})\n        \n        if queue:  # Don't sleep after last batch\n            await asyncio.sleep(1)  # 1 second between batches\n    \n    return results\n```\n\n**Key:** Set `rate_per_second` based on your number pool size, not your desired speed. Sending faster than your pool supports just generates 429s.\n\n> **Compliance:** Before bulk sending, verify recipient consent (opt-in records), respect quiet hours, and implement maximum batch size limits. Monitor for anomalous send patterns that could indicate abuse.\n\n### 4. StatusCallback Resilience\n\nAt scale, StatusCallbacks create their own load problem.\n\n**The math:** 50 concurrent calls × 6 status events per call = 300 webhook invocations per second. Twilio Functions allow 30 concurrent executions per service.\n\n**Thin-receiver pattern** — receive, queue, respond immediately:\n\n**Node.js (Express)**\n```node\nconst { Queue } = require(\"bullmq\");\nconst statusQueue = new Queue(\"twilio-status\");\n\n\u002F\u002F Thin receiver: accept callback, queue it, respond 200 immediately\napp.post(\"\u002Fstatus\", async (req, res) => {\n    await statusQueue.add(\"status-event\", {\n        callSid: req.body.CallSid,\n        callStatus: req.body.CallStatus,\n        timestamp: Date.now(),\n    });\n    res.sendStatus(200);  \u002F\u002F Respond FAST — Twilio will retry on timeout\n});\n\n\u002F\u002F Process asynchronously\nconst worker = new Worker(\"twilio-status\", async (job) => {\n    const { callSid, callStatus } = job.data;\n    await updateDatabase(callSid, callStatus);\n});\n```\n\n**Python (Flask + Celery)**\n```python\n@app.route(\"\u002Fstatus\", methods=[\"POST\"])\ndef status_callback():\n    # Queue for async processing\n    process_status.delay(\n        call_sid=request.form[\"CallSid\"],\n        call_status=request.form[\"CallStatus\"]\n    )\n    return \"\", 200  # Respond FAST\n\n@celery.task\ndef process_status(call_sid, call_status):\n    update_database(call_sid, call_status)\n```\n\n**Idempotency key:** Use `{CallSid}-{CallStatus}` as a composite key. Twilio retries on timeout, which can cause duplicate callbacks. Deduplicate before processing.\n\n### 5. Fallback Chains\n\nWhen delivery on one channel fails, escalate to the next:\n\n**Python**\n```python\nasync def send_with_fallback(client, to, message, messaging_service_sid):\n    \"\"\"Try SMS → Voice → Email fallback chain.\"\"\"\n    \n    # Try SMS first\n    try:\n        msg = client.messages.create(\n            to=to, body=message, messaging_service_sid=messaging_service_sid,\n            status_callback=\"https:\u002F\u002Fyourapp.com\u002Fstatus\"\n        )\n        # Wait for delivery confirmation via StatusCallback\n        # If undelivered after timeout, fall through to voice\n        return {\"channel\": \"sms\", \"sid\": msg.sid}\n    except Exception:\n        pass  # SMS failed, try voice\n    \n    # Fallback to voice\n    try:\n        call = client.calls.create(\n            to=to, from_=\"+15551234567\",\n            twiml=f\"\u003CResponse>\u003CSay>{message}\u003C\u002FSay>\u003C\u002FResponse>\",\n            status_callback=\"https:\u002F\u002Fyourapp.com\u002Fcall-status\"\n        )\n        return {\"channel\": \"voice\", \"sid\": call.sid}\n    except Exception:\n        pass  # Voice failed, try email\n    \n    # Last resort: email\n    # Use SendGrid — see twilio-sendgrid-email\n    return {\"channel\": \"email\", \"status\": \"queued\"}\n```\n\n### 6. Voice Concurrency Limits\n\n| Resource | Default limit | Notes |\n|----------|--------------|-------|\n| Concurrent calls per account | 1 (trial) \u002F variable (paid) | Request increase via support |\n| Calls per second (CPS) | 1 CPS (default) | Increase via support for outbound campaigns |\n| Conference participants | 250 per conference | |\n| Twilio Functions concurrent | 30 per service | Use thin-receiver pattern above |\n\nFor outbound campaigns, request CPS increase before launch — not during.\n\n### 7. Webhook Timeout Handling\n\nTwilio expects a response within **15 seconds** for voice webhooks and **15 seconds** for messaging webhooks. If your endpoint doesn't respond:\n- Voice: Twilio hangs up or falls back to `voiceFallbackUrl`\n- Messaging: Twilio retries the callback\n\n**Always configure fallback URLs:**\n```python\n# On phone number configuration\nnumber = client.incoming_phone_numbers(phone_sid).update(\n    voice_url=\"https:\u002F\u002Fyourapp.com\u002Fvoice\",\n    voice_fallback_url=\"https:\u002F\u002Fyourapp.com\u002Fvoice-fallback\",  # backup endpoint\n    sms_url=\"https:\u002F\u002Fyourapp.com\u002Fsms\",\n    sms_fallback_url=\"https:\u002F\u002Fyourapp.com\u002Fsms-fallback\"\n)\n```\n\n---\n\n## Monitoring Checklist\n\nSet up these alerts before going to production:\n\n| Metric | Alert threshold | How to track |\n|--------|----------------|-------------|\n| 429 error rate | > 5% of requests | Count 429s in your backoff handler |\n| Delivery failure rate | > 2% of messages | StatusCallback `failed`\u002F`undelivered` events |\n| Webhook response time | > 5 seconds p95 | Your APM tool (DataDog, New Relic) |\n| Queue depth | Growing over 5 minutes | Your message queue metrics |\n| Concurrent calls | > 80% of limit | Twilio Usage API or Event Streams |\n\nTwilio's built-in alerting systems are under-used — end-users often discover issues before developers do. Configure StatusCallbacks + Event Streams for delivery failure alerts on every integration.\n\n---\n\n## CANNOT\n\n- **Cannot avoid 429 errors on any Twilio API** — Backoff patterns apply to all APIs (Messaging, Voice, Verify, Lookup)\n- **Cannot increase per-number throughput** — Add more numbers via Messaging Services instead\n- **Cannot configure StatusCallback retry behavior** — Twilio retries on timeout automatically; not configurable\n- **Cannot exceed Twilio Functions limits** — 30 concurrent executions\u002Fservice, 10-second timeout, 256 MB memory\n- **Cannot use a native Twilio rate limiting API** — You must implement rate limiting in your application\n\n---\n\n## Next Steps\n\n- **Messaging at scale:** `twilio-messaging-services`\n- **Monitor delivery:** `twilio-sms-send-message` (StatusCallbacks)\n- **Debug failures:** `twilio-debugging-observability`\n- **Compliance for bulk sends:** `twilio-compliance-traffic`\n",{"data":34,"body":35},{"name":4,"description":6},{"type":36,"children":37},"root",[38,47,53,58,62,68,103,106,112,119,124,133,353,361,563,571,599,605,610,738,748,754,759,766,962,980,994,1000,1005,1015,1025,1033,1181,1189,1291,1309,1315,1320,1327,1564,1570,1666,1671,1677,1695,1714,1722,1785,1788,1794,1799,1932,1937,1940,1946,1999,2002,2008,2072],{"type":39,"tag":40,"props":41,"children":43},"element","h2",{"id":42},"overview",[44],{"type":45,"value":46},"text","Overview",{"type":39,"tag":48,"props":49,"children":50},"p",{},[51],{"type":45,"value":52},"Twilio enforces per-resource rate limits. At scale, 429 errors are expected behavior — not bugs. This skill teaches the patterns that prevent production failures: exponential backoff, throughput management, and resilient callback handling.",{"type":39,"tag":48,"props":54,"children":55},{},[56],{"type":45,"value":57},"429 concurrency errors are not well documented — implement exponential backoff with ±10% jitter.",{"type":39,"tag":59,"props":60,"children":61},"hr",{},[],{"type":39,"tag":40,"props":63,"children":65},{"id":64},"prerequisites",[66],{"type":45,"value":67},"Prerequisites",{"type":39,"tag":69,"props":70,"children":71},"ul",{},[72,78,83],{"type":39,"tag":73,"props":74,"children":75},"li",{},[76],{"type":45,"value":77},"A working Twilio integration (any product)",{"type":39,"tag":73,"props":79,"children":80},{},[81],{"type":45,"value":82},"Understanding of your expected volume (messages\u002Fsec, calls\u002Fsec)",{"type":39,"tag":73,"props":84,"children":85},{},[86,88,95,97],{"type":45,"value":87},"StatusCallback URLs configured — see ",{"type":39,"tag":89,"props":90,"children":92},"code",{"className":91},[],[93],{"type":45,"value":94},"twilio-messaging-services",{"type":45,"value":96},", ",{"type":39,"tag":89,"props":98,"children":100},{"className":99},[],[101],{"type":45,"value":102},"twilio-sms-send-message",{"type":39,"tag":59,"props":104,"children":105},{},[],{"type":39,"tag":40,"props":107,"children":109},{"id":108},"key-patterns",[110],{"type":45,"value":111},"Key Patterns",{"type":39,"tag":113,"props":114,"children":116},"h3",{"id":115},"_1-exponential-backoff-with-jitter",[117],{"type":45,"value":118},"1. Exponential Backoff with Jitter",{"type":39,"tag":48,"props":120,"children":121},{},[122],{"type":45,"value":123},"When you receive a 429 (Too Many Requests), wait and retry. Naive fixed-interval retry creates thundering herds. Use exponential backoff with randomized jitter.",{"type":39,"tag":48,"props":125,"children":126},{},[127],{"type":39,"tag":128,"props":129,"children":130},"strong",{},[131],{"type":45,"value":132},"Python",{"type":39,"tag":134,"props":135,"children":140},"pre",{"className":136,"code":137,"language":138,"meta":139,"style":139},"language-python shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import time, random, requests\n\ndef send_with_backoff(client, to, body, messaging_service_sid, max_retries=5):\n    for attempt in range(max_retries):\n        try:\n            message = client.messages.create(\n                to=to,\n                body=body,\n                messaging_service_sid=messaging_service_sid,\n                status_callback=\"https:\u002F\u002Fyourapp.com\u002Fstatus\"\n            )\n            return message\n        except Exception as e:\n            if hasattr(e, 'status') and e.status == 429:\n                # Exponential backoff: 100ms, 200ms, 400ms, 800ms, 1600ms\n                base_delay = 0.1 * (2 ** attempt)\n                # Add ±10% jitter to prevent thundering herd\n                jitter = base_delay * 0.1 * (2 * random.random() - 1)\n                delay = min(base_delay + jitter, 30)  # cap at 30 seconds\n                time.sleep(delay)\n            else:\n                raise  # Non-429 errors: don't retry, investigate\n    raise Exception(f\"Failed after {max_retries} retries\")\n","python","",[141],{"type":39,"tag":89,"props":142,"children":143},{"__ignoreMap":139},[144,155,165,174,183,192,201,209,218,227,236,245,254,263,272,281,290,299,308,317,326,335,344],{"type":39,"tag":145,"props":146,"children":149},"span",{"class":147,"line":148},"line",1,[150],{"type":39,"tag":145,"props":151,"children":152},{},[153],{"type":45,"value":154},"import time, random, requests\n",{"type":39,"tag":145,"props":156,"children":158},{"class":147,"line":157},2,[159],{"type":39,"tag":145,"props":160,"children":162},{"emptyLinePlaceholder":161},true,[163],{"type":45,"value":164},"\n",{"type":39,"tag":145,"props":166,"children":168},{"class":147,"line":167},3,[169],{"type":39,"tag":145,"props":170,"children":171},{},[172],{"type":45,"value":173},"def send_with_backoff(client, to, body, messaging_service_sid, max_retries=5):\n",{"type":39,"tag":145,"props":175,"children":177},{"class":147,"line":176},4,[178],{"type":39,"tag":145,"props":179,"children":180},{},[181],{"type":45,"value":182},"    for attempt in range(max_retries):\n",{"type":39,"tag":145,"props":184,"children":186},{"class":147,"line":185},5,[187],{"type":39,"tag":145,"props":188,"children":189},{},[190],{"type":45,"value":191},"        try:\n",{"type":39,"tag":145,"props":193,"children":195},{"class":147,"line":194},6,[196],{"type":39,"tag":145,"props":197,"children":198},{},[199],{"type":45,"value":200},"            message = client.messages.create(\n",{"type":39,"tag":145,"props":202,"children":203},{"class":147,"line":27},[204],{"type":39,"tag":145,"props":205,"children":206},{},[207],{"type":45,"value":208},"                to=to,\n",{"type":39,"tag":145,"props":210,"children":212},{"class":147,"line":211},8,[213],{"type":39,"tag":145,"props":214,"children":215},{},[216],{"type":45,"value":217},"                body=body,\n",{"type":39,"tag":145,"props":219,"children":221},{"class":147,"line":220},9,[222],{"type":39,"tag":145,"props":223,"children":224},{},[225],{"type":45,"value":226},"                messaging_service_sid=messaging_service_sid,\n",{"type":39,"tag":145,"props":228,"children":230},{"class":147,"line":229},10,[231],{"type":39,"tag":145,"props":232,"children":233},{},[234],{"type":45,"value":235},"                status_callback=\"https:\u002F\u002Fyourapp.com\u002Fstatus\"\n",{"type":39,"tag":145,"props":237,"children":239},{"class":147,"line":238},11,[240],{"type":39,"tag":145,"props":241,"children":242},{},[243],{"type":45,"value":244},"            )\n",{"type":39,"tag":145,"props":246,"children":248},{"class":147,"line":247},12,[249],{"type":39,"tag":145,"props":250,"children":251},{},[252],{"type":45,"value":253},"            return message\n",{"type":39,"tag":145,"props":255,"children":257},{"class":147,"line":256},13,[258],{"type":39,"tag":145,"props":259,"children":260},{},[261],{"type":45,"value":262},"        except Exception as e:\n",{"type":39,"tag":145,"props":264,"children":266},{"class":147,"line":265},14,[267],{"type":39,"tag":145,"props":268,"children":269},{},[270],{"type":45,"value":271},"            if hasattr(e, 'status') and e.status == 429:\n",{"type":39,"tag":145,"props":273,"children":275},{"class":147,"line":274},15,[276],{"type":39,"tag":145,"props":277,"children":278},{},[279],{"type":45,"value":280},"                # Exponential backoff: 100ms, 200ms, 400ms, 800ms, 1600ms\n",{"type":39,"tag":145,"props":282,"children":284},{"class":147,"line":283},16,[285],{"type":39,"tag":145,"props":286,"children":287},{},[288],{"type":45,"value":289},"                base_delay = 0.1 * (2 ** attempt)\n",{"type":39,"tag":145,"props":291,"children":293},{"class":147,"line":292},17,[294],{"type":39,"tag":145,"props":295,"children":296},{},[297],{"type":45,"value":298},"                # Add ±10% jitter to prevent thundering herd\n",{"type":39,"tag":145,"props":300,"children":302},{"class":147,"line":301},18,[303],{"type":39,"tag":145,"props":304,"children":305},{},[306],{"type":45,"value":307},"                jitter = base_delay * 0.1 * (2 * random.random() - 1)\n",{"type":39,"tag":145,"props":309,"children":311},{"class":147,"line":310},19,[312],{"type":39,"tag":145,"props":313,"children":314},{},[315],{"type":45,"value":316},"                delay = min(base_delay + jitter, 30)  # cap at 30 seconds\n",{"type":39,"tag":145,"props":318,"children":320},{"class":147,"line":319},20,[321],{"type":39,"tag":145,"props":322,"children":323},{},[324],{"type":45,"value":325},"                time.sleep(delay)\n",{"type":39,"tag":145,"props":327,"children":329},{"class":147,"line":328},21,[330],{"type":39,"tag":145,"props":331,"children":332},{},[333],{"type":45,"value":334},"            else:\n",{"type":39,"tag":145,"props":336,"children":338},{"class":147,"line":337},22,[339],{"type":39,"tag":145,"props":340,"children":341},{},[342],{"type":45,"value":343},"                raise  # Non-429 errors: don't retry, investigate\n",{"type":39,"tag":145,"props":345,"children":347},{"class":147,"line":346},23,[348],{"type":39,"tag":145,"props":349,"children":350},{},[351],{"type":45,"value":352},"    raise Exception(f\"Failed after {max_retries} retries\")\n",{"type":39,"tag":48,"props":354,"children":355},{},[356],{"type":39,"tag":128,"props":357,"children":358},{},[359],{"type":45,"value":360},"Node.js",{"type":39,"tag":134,"props":362,"children":366},{"className":363,"code":364,"language":365,"meta":139,"style":139},"language-node shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","async function sendWithBackoff(client, to, body, messagingServiceSid, maxRetries = 5) {\n    for (let attempt = 0; attempt \u003C maxRetries; attempt++) {\n        try {\n            return await client.messages.create({\n                to,\n                body,\n                messagingServiceSid,\n                statusCallback: \"https:\u002F\u002Fyourapp.com\u002Fstatus\",\n            });\n        } catch (err) {\n            if (err.status === 429) {\n                \u002F\u002F Exponential backoff: 100ms, 200ms, 400ms, 800ms, 1600ms\n                const baseDelay = 100 * Math.pow(2, attempt);\n                \u002F\u002F Add ±10% jitter\n                const jitter = baseDelay * 0.1 * (2 * Math.random() - 1);\n                const delay = Math.min(baseDelay + jitter, 30000); \u002F\u002F cap at 30s\n                await new Promise(r => setTimeout(r, delay));\n            } else {\n                throw err; \u002F\u002F Non-429: don't retry\n            }\n        }\n    }\n    throw new Error(`Failed after ${maxRetries} retries`);\n}\n","node",[367],{"type":39,"tag":89,"props":368,"children":369},{"__ignoreMap":139},[370,378,386,394,402,410,418,426,434,442,450,458,466,474,482,490,498,506,514,522,530,538,546,554],{"type":39,"tag":145,"props":371,"children":372},{"class":147,"line":148},[373],{"type":39,"tag":145,"props":374,"children":375},{},[376],{"type":45,"value":377},"async function sendWithBackoff(client, to, body, messagingServiceSid, maxRetries = 5) {\n",{"type":39,"tag":145,"props":379,"children":380},{"class":147,"line":157},[381],{"type":39,"tag":145,"props":382,"children":383},{},[384],{"type":45,"value":385},"    for (let attempt = 0; attempt \u003C maxRetries; attempt++) {\n",{"type":39,"tag":145,"props":387,"children":388},{"class":147,"line":167},[389],{"type":39,"tag":145,"props":390,"children":391},{},[392],{"type":45,"value":393},"        try {\n",{"type":39,"tag":145,"props":395,"children":396},{"class":147,"line":176},[397],{"type":39,"tag":145,"props":398,"children":399},{},[400],{"type":45,"value":401},"            return await client.messages.create({\n",{"type":39,"tag":145,"props":403,"children":404},{"class":147,"line":185},[405],{"type":39,"tag":145,"props":406,"children":407},{},[408],{"type":45,"value":409},"                to,\n",{"type":39,"tag":145,"props":411,"children":412},{"class":147,"line":194},[413],{"type":39,"tag":145,"props":414,"children":415},{},[416],{"type":45,"value":417},"                body,\n",{"type":39,"tag":145,"props":419,"children":420},{"class":147,"line":27},[421],{"type":39,"tag":145,"props":422,"children":423},{},[424],{"type":45,"value":425},"                messagingServiceSid,\n",{"type":39,"tag":145,"props":427,"children":428},{"class":147,"line":211},[429],{"type":39,"tag":145,"props":430,"children":431},{},[432],{"type":45,"value":433},"                statusCallback: \"https:\u002F\u002Fyourapp.com\u002Fstatus\",\n",{"type":39,"tag":145,"props":435,"children":436},{"class":147,"line":220},[437],{"type":39,"tag":145,"props":438,"children":439},{},[440],{"type":45,"value":441},"            });\n",{"type":39,"tag":145,"props":443,"children":444},{"class":147,"line":229},[445],{"type":39,"tag":145,"props":446,"children":447},{},[448],{"type":45,"value":449},"        } catch (err) {\n",{"type":39,"tag":145,"props":451,"children":452},{"class":147,"line":238},[453],{"type":39,"tag":145,"props":454,"children":455},{},[456],{"type":45,"value":457},"            if (err.status === 429) {\n",{"type":39,"tag":145,"props":459,"children":460},{"class":147,"line":247},[461],{"type":39,"tag":145,"props":462,"children":463},{},[464],{"type":45,"value":465},"                \u002F\u002F Exponential backoff: 100ms, 200ms, 400ms, 800ms, 1600ms\n",{"type":39,"tag":145,"props":467,"children":468},{"class":147,"line":256},[469],{"type":39,"tag":145,"props":470,"children":471},{},[472],{"type":45,"value":473},"                const baseDelay = 100 * Math.pow(2, attempt);\n",{"type":39,"tag":145,"props":475,"children":476},{"class":147,"line":265},[477],{"type":39,"tag":145,"props":478,"children":479},{},[480],{"type":45,"value":481},"                \u002F\u002F Add ±10% jitter\n",{"type":39,"tag":145,"props":483,"children":484},{"class":147,"line":274},[485],{"type":39,"tag":145,"props":486,"children":487},{},[488],{"type":45,"value":489},"                const jitter = baseDelay * 0.1 * (2 * Math.random() - 1);\n",{"type":39,"tag":145,"props":491,"children":492},{"class":147,"line":283},[493],{"type":39,"tag":145,"props":494,"children":495},{},[496],{"type":45,"value":497},"                const delay = Math.min(baseDelay + jitter, 30000); \u002F\u002F cap at 30s\n",{"type":39,"tag":145,"props":499,"children":500},{"class":147,"line":292},[501],{"type":39,"tag":145,"props":502,"children":503},{},[504],{"type":45,"value":505},"                await new Promise(r => setTimeout(r, delay));\n",{"type":39,"tag":145,"props":507,"children":508},{"class":147,"line":301},[509],{"type":39,"tag":145,"props":510,"children":511},{},[512],{"type":45,"value":513},"            } else {\n",{"type":39,"tag":145,"props":515,"children":516},{"class":147,"line":310},[517],{"type":39,"tag":145,"props":518,"children":519},{},[520],{"type":45,"value":521},"                throw err; \u002F\u002F Non-429: don't retry\n",{"type":39,"tag":145,"props":523,"children":524},{"class":147,"line":319},[525],{"type":39,"tag":145,"props":526,"children":527},{},[528],{"type":45,"value":529},"            }\n",{"type":39,"tag":145,"props":531,"children":532},{"class":147,"line":328},[533],{"type":39,"tag":145,"props":534,"children":535},{},[536],{"type":45,"value":537},"        }\n",{"type":39,"tag":145,"props":539,"children":540},{"class":147,"line":337},[541],{"type":39,"tag":145,"props":542,"children":543},{},[544],{"type":45,"value":545},"    }\n",{"type":39,"tag":145,"props":547,"children":548},{"class":147,"line":346},[549],{"type":39,"tag":145,"props":550,"children":551},{},[552],{"type":45,"value":553},"    throw new Error(`Failed after ${maxRetries} retries`);\n",{"type":39,"tag":145,"props":555,"children":557},{"class":147,"line":556},24,[558],{"type":39,"tag":145,"props":559,"children":560},{},[561],{"type":45,"value":562},"}\n",{"type":39,"tag":48,"props":564,"children":565},{},[566],{"type":39,"tag":128,"props":567,"children":568},{},[569],{"type":45,"value":570},"Parameters:",{"type":39,"tag":69,"props":572,"children":573},{},[574,579,584,589,594],{"type":39,"tag":73,"props":575,"children":576},{},[577],{"type":45,"value":578},"Initial delay: 100ms",{"type":39,"tag":73,"props":580,"children":581},{},[582],{"type":45,"value":583},"Multiplier: 2x per attempt",{"type":39,"tag":73,"props":585,"children":586},{},[587],{"type":45,"value":588},"Jitter: ±10% of base delay (randomized)",{"type":39,"tag":73,"props":590,"children":591},{},[592],{"type":45,"value":593},"Max delay: 30 seconds",{"type":39,"tag":73,"props":595,"children":596},{},[597],{"type":45,"value":598},"Max retries: 5 (covers up to ~3.2 second base delay)",{"type":39,"tag":113,"props":600,"children":602},{"id":601},"_2-per-number-throughput-limits",[603],{"type":45,"value":604},"2. Per-Number Throughput Limits",{"type":39,"tag":48,"props":606,"children":607},{},[608],{"type":45,"value":609},"These limits are not prominently documented:",{"type":39,"tag":611,"props":612,"children":613},"table",{},[614,643],{"type":39,"tag":615,"props":616,"children":617},"thead",{},[618],{"type":39,"tag":619,"props":620,"children":621},"tr",{},[622,628,633,638],{"type":39,"tag":623,"props":624,"children":625},"th",{},[626],{"type":45,"value":627},"Number type",{"type":39,"tag":623,"props":629,"children":630},{},[631],{"type":45,"value":632},"SMS throughput",{"type":39,"tag":623,"props":634,"children":635},{},[636],{"type":45,"value":637},"Voice throughput",{"type":39,"tag":623,"props":639,"children":640},{},[641],{"type":45,"value":642},"Notes",{"type":39,"tag":644,"props":645,"children":646},"tbody",{},[647,671,694,716],{"type":39,"tag":619,"props":648,"children":649},{},[650,656,661,666],{"type":39,"tag":651,"props":652,"children":653},"td",{},[654],{"type":45,"value":655},"Local (long code)",{"type":39,"tag":651,"props":657,"children":658},{},[659],{"type":45,"value":660},"~1 SMS\u002Fsec",{"type":39,"tag":651,"props":662,"children":663},{},[664],{"type":45,"value":665},"1 concurrent call",{"type":39,"tag":651,"props":667,"children":668},{},[669],{"type":45,"value":670},"Lowest cost, lowest throughput",{"type":39,"tag":619,"props":672,"children":673},{},[674,679,684,689],{"type":39,"tag":651,"props":675,"children":676},{},[677],{"type":45,"value":678},"Toll-free",{"type":39,"tag":651,"props":680,"children":681},{},[682],{"type":45,"value":683},"~3 SMS\u002Fsec",{"type":39,"tag":651,"props":685,"children":686},{},[687],{"type":45,"value":688},"—",{"type":39,"tag":651,"props":690,"children":691},{},[692],{"type":45,"value":693},"Faster verification (3-5 days)",{"type":39,"tag":619,"props":695,"children":696},{},[697,702,707,711],{"type":39,"tag":651,"props":698,"children":699},{},[700],{"type":45,"value":701},"Short code",{"type":39,"tag":651,"props":703,"children":704},{},[705],{"type":45,"value":706},"10-100 SMS\u002Fsec",{"type":39,"tag":651,"props":708,"children":709},{},[710],{"type":45,"value":688},{"type":39,"tag":651,"props":712,"children":713},{},[714],{"type":45,"value":715},"Highest throughput, 8-12 week provisioning, expensive",{"type":39,"tag":619,"props":717,"children":718},{},[719,724,729,733],{"type":39,"tag":651,"props":720,"children":721},{},[722],{"type":45,"value":723},"Messaging Service (pool)",{"type":39,"tag":651,"props":725,"children":726},{},[727],{"type":45,"value":728},"Sum of all numbers in pool",{"type":39,"tag":651,"props":730,"children":731},{},[732],{"type":45,"value":688},{"type":39,"tag":651,"props":734,"children":735},{},[736],{"type":45,"value":737},"Multiply throughput by adding numbers",{"type":39,"tag":48,"props":739,"children":740},{},[741,746],{"type":39,"tag":128,"props":742,"children":743},{},[744],{"type":45,"value":745},"Throughput opacity:",{"type":45,"value":747}," Sending velocity and queue depth are opaque — there is no dashboard showing messages per second. Use Messaging Services to multiply throughput by pooling numbers. A pool of 10 long codes = ~10 SMS\u002Fsec.",{"type":39,"tag":113,"props":749,"children":751},{"id":750},"_3-bulk-send-pattern",[752],{"type":45,"value":753},"3. Bulk Send Pattern",{"type":39,"tag":48,"props":755,"children":756},{},[757],{"type":45,"value":758},"For sending to large lists, use a rate-limited dispatch loop:",{"type":39,"tag":48,"props":760,"children":761},{},[762],{"type":39,"tag":128,"props":763,"children":764},{},[765],{"type":45,"value":132},{"type":39,"tag":134,"props":767,"children":769},{"className":136,"code":768,"language":138,"meta":139,"style":139},"import asyncio\nfrom collections import deque\n\nasync def bulk_send(client, recipients, body, messaging_service_sid, rate_per_second=10):\n    \"\"\"Send to a list of recipients with rate limiting and backoff.\"\"\"\n    queue = deque(recipients)\n    results = []\n    \n    while queue:\n        batch = []\n        for _ in range(min(rate_per_second, len(queue))):\n            batch.append(queue.popleft())\n        \n        for recipient in batch:\n            try:\n                msg = send_with_backoff(client, recipient, body, messaging_service_sid)\n                results.append({\"to\": recipient, \"sid\": msg.sid, \"status\": \"sent\"})\n            except Exception as e:\n                results.append({\"to\": recipient, \"error\": str(e), \"status\": \"failed\"})\n        \n        if queue:  # Don't sleep after last batch\n            await asyncio.sleep(1)  # 1 second between batches\n    \n    return results\n",[770],{"type":39,"tag":89,"props":771,"children":772},{"__ignoreMap":139},[773,781,789,796,804,812,820,828,836,844,852,860,868,876,884,892,900,908,916,924,931,939,947,954],{"type":39,"tag":145,"props":774,"children":775},{"class":147,"line":148},[776],{"type":39,"tag":145,"props":777,"children":778},{},[779],{"type":45,"value":780},"import asyncio\n",{"type":39,"tag":145,"props":782,"children":783},{"class":147,"line":157},[784],{"type":39,"tag":145,"props":785,"children":786},{},[787],{"type":45,"value":788},"from collections import deque\n",{"type":39,"tag":145,"props":790,"children":791},{"class":147,"line":167},[792],{"type":39,"tag":145,"props":793,"children":794},{"emptyLinePlaceholder":161},[795],{"type":45,"value":164},{"type":39,"tag":145,"props":797,"children":798},{"class":147,"line":176},[799],{"type":39,"tag":145,"props":800,"children":801},{},[802],{"type":45,"value":803},"async def bulk_send(client, recipients, body, messaging_service_sid, rate_per_second=10):\n",{"type":39,"tag":145,"props":805,"children":806},{"class":147,"line":185},[807],{"type":39,"tag":145,"props":808,"children":809},{},[810],{"type":45,"value":811},"    \"\"\"Send to a list of recipients with rate limiting and backoff.\"\"\"\n",{"type":39,"tag":145,"props":813,"children":814},{"class":147,"line":194},[815],{"type":39,"tag":145,"props":816,"children":817},{},[818],{"type":45,"value":819},"    queue = deque(recipients)\n",{"type":39,"tag":145,"props":821,"children":822},{"class":147,"line":27},[823],{"type":39,"tag":145,"props":824,"children":825},{},[826],{"type":45,"value":827},"    results = []\n",{"type":39,"tag":145,"props":829,"children":830},{"class":147,"line":211},[831],{"type":39,"tag":145,"props":832,"children":833},{},[834],{"type":45,"value":835},"    \n",{"type":39,"tag":145,"props":837,"children":838},{"class":147,"line":220},[839],{"type":39,"tag":145,"props":840,"children":841},{},[842],{"type":45,"value":843},"    while queue:\n",{"type":39,"tag":145,"props":845,"children":846},{"class":147,"line":229},[847],{"type":39,"tag":145,"props":848,"children":849},{},[850],{"type":45,"value":851},"        batch = []\n",{"type":39,"tag":145,"props":853,"children":854},{"class":147,"line":238},[855],{"type":39,"tag":145,"props":856,"children":857},{},[858],{"type":45,"value":859},"        for _ in range(min(rate_per_second, len(queue))):\n",{"type":39,"tag":145,"props":861,"children":862},{"class":147,"line":247},[863],{"type":39,"tag":145,"props":864,"children":865},{},[866],{"type":45,"value":867},"            batch.append(queue.popleft())\n",{"type":39,"tag":145,"props":869,"children":870},{"class":147,"line":256},[871],{"type":39,"tag":145,"props":872,"children":873},{},[874],{"type":45,"value":875},"        \n",{"type":39,"tag":145,"props":877,"children":878},{"class":147,"line":265},[879],{"type":39,"tag":145,"props":880,"children":881},{},[882],{"type":45,"value":883},"        for recipient in batch:\n",{"type":39,"tag":145,"props":885,"children":886},{"class":147,"line":274},[887],{"type":39,"tag":145,"props":888,"children":889},{},[890],{"type":45,"value":891},"            try:\n",{"type":39,"tag":145,"props":893,"children":894},{"class":147,"line":283},[895],{"type":39,"tag":145,"props":896,"children":897},{},[898],{"type":45,"value":899},"                msg = send_with_backoff(client, recipient, body, messaging_service_sid)\n",{"type":39,"tag":145,"props":901,"children":902},{"class":147,"line":292},[903],{"type":39,"tag":145,"props":904,"children":905},{},[906],{"type":45,"value":907},"                results.append({\"to\": recipient, \"sid\": msg.sid, \"status\": \"sent\"})\n",{"type":39,"tag":145,"props":909,"children":910},{"class":147,"line":301},[911],{"type":39,"tag":145,"props":912,"children":913},{},[914],{"type":45,"value":915},"            except Exception as e:\n",{"type":39,"tag":145,"props":917,"children":918},{"class":147,"line":310},[919],{"type":39,"tag":145,"props":920,"children":921},{},[922],{"type":45,"value":923},"                results.append({\"to\": recipient, \"error\": str(e), \"status\": \"failed\"})\n",{"type":39,"tag":145,"props":925,"children":926},{"class":147,"line":319},[927],{"type":39,"tag":145,"props":928,"children":929},{},[930],{"type":45,"value":875},{"type":39,"tag":145,"props":932,"children":933},{"class":147,"line":328},[934],{"type":39,"tag":145,"props":935,"children":936},{},[937],{"type":45,"value":938},"        if queue:  # Don't sleep after last batch\n",{"type":39,"tag":145,"props":940,"children":941},{"class":147,"line":337},[942],{"type":39,"tag":145,"props":943,"children":944},{},[945],{"type":45,"value":946},"            await asyncio.sleep(1)  # 1 second between batches\n",{"type":39,"tag":145,"props":948,"children":949},{"class":147,"line":346},[950],{"type":39,"tag":145,"props":951,"children":952},{},[953],{"type":45,"value":835},{"type":39,"tag":145,"props":955,"children":956},{"class":147,"line":556},[957],{"type":39,"tag":145,"props":958,"children":959},{},[960],{"type":45,"value":961},"    return results\n",{"type":39,"tag":48,"props":963,"children":964},{},[965,970,972,978],{"type":39,"tag":128,"props":966,"children":967},{},[968],{"type":45,"value":969},"Key:",{"type":45,"value":971}," Set ",{"type":39,"tag":89,"props":973,"children":975},{"className":974},[],[976],{"type":45,"value":977},"rate_per_second",{"type":45,"value":979}," based on your number pool size, not your desired speed. Sending faster than your pool supports just generates 429s.",{"type":39,"tag":981,"props":982,"children":983},"blockquote",{},[984],{"type":39,"tag":48,"props":985,"children":986},{},[987,992],{"type":39,"tag":128,"props":988,"children":989},{},[990],{"type":45,"value":991},"Compliance:",{"type":45,"value":993}," Before bulk sending, verify recipient consent (opt-in records), respect quiet hours, and implement maximum batch size limits. Monitor for anomalous send patterns that could indicate abuse.",{"type":39,"tag":113,"props":995,"children":997},{"id":996},"_4-statuscallback-resilience",[998],{"type":45,"value":999},"4. StatusCallback Resilience",{"type":39,"tag":48,"props":1001,"children":1002},{},[1003],{"type":45,"value":1004},"At scale, StatusCallbacks create their own load problem.",{"type":39,"tag":48,"props":1006,"children":1007},{},[1008,1013],{"type":39,"tag":128,"props":1009,"children":1010},{},[1011],{"type":45,"value":1012},"The math:",{"type":45,"value":1014}," 50 concurrent calls × 6 status events per call = 300 webhook invocations per second. Twilio Functions allow 30 concurrent executions per service.",{"type":39,"tag":48,"props":1016,"children":1017},{},[1018,1023],{"type":39,"tag":128,"props":1019,"children":1020},{},[1021],{"type":45,"value":1022},"Thin-receiver pattern",{"type":45,"value":1024}," — receive, queue, respond immediately:",{"type":39,"tag":48,"props":1026,"children":1027},{},[1028],{"type":39,"tag":128,"props":1029,"children":1030},{},[1031],{"type":45,"value":1032},"Node.js (Express)",{"type":39,"tag":134,"props":1034,"children":1036},{"className":363,"code":1035,"language":365,"meta":139,"style":139},"const { Queue } = require(\"bullmq\");\nconst statusQueue = new Queue(\"twilio-status\");\n\n\u002F\u002F Thin receiver: accept callback, queue it, respond 200 immediately\napp.post(\"\u002Fstatus\", async (req, res) => {\n    await statusQueue.add(\"status-event\", {\n        callSid: req.body.CallSid,\n        callStatus: req.body.CallStatus,\n        timestamp: Date.now(),\n    });\n    res.sendStatus(200);  \u002F\u002F Respond FAST — Twilio will retry on timeout\n});\n\n\u002F\u002F Process asynchronously\nconst worker = new Worker(\"twilio-status\", async (job) => {\n    const { callSid, callStatus } = job.data;\n    await updateDatabase(callSid, callStatus);\n});\n",[1037],{"type":39,"tag":89,"props":1038,"children":1039},{"__ignoreMap":139},[1040,1048,1056,1063,1071,1079,1087,1095,1103,1111,1119,1127,1135,1142,1150,1158,1166,1174],{"type":39,"tag":145,"props":1041,"children":1042},{"class":147,"line":148},[1043],{"type":39,"tag":145,"props":1044,"children":1045},{},[1046],{"type":45,"value":1047},"const { Queue } = require(\"bullmq\");\n",{"type":39,"tag":145,"props":1049,"children":1050},{"class":147,"line":157},[1051],{"type":39,"tag":145,"props":1052,"children":1053},{},[1054],{"type":45,"value":1055},"const statusQueue = new Queue(\"twilio-status\");\n",{"type":39,"tag":145,"props":1057,"children":1058},{"class":147,"line":167},[1059],{"type":39,"tag":145,"props":1060,"children":1061},{"emptyLinePlaceholder":161},[1062],{"type":45,"value":164},{"type":39,"tag":145,"props":1064,"children":1065},{"class":147,"line":176},[1066],{"type":39,"tag":145,"props":1067,"children":1068},{},[1069],{"type":45,"value":1070},"\u002F\u002F Thin receiver: accept callback, queue it, respond 200 immediately\n",{"type":39,"tag":145,"props":1072,"children":1073},{"class":147,"line":185},[1074],{"type":39,"tag":145,"props":1075,"children":1076},{},[1077],{"type":45,"value":1078},"app.post(\"\u002Fstatus\", async (req, res) => {\n",{"type":39,"tag":145,"props":1080,"children":1081},{"class":147,"line":194},[1082],{"type":39,"tag":145,"props":1083,"children":1084},{},[1085],{"type":45,"value":1086},"    await statusQueue.add(\"status-event\", {\n",{"type":39,"tag":145,"props":1088,"children":1089},{"class":147,"line":27},[1090],{"type":39,"tag":145,"props":1091,"children":1092},{},[1093],{"type":45,"value":1094},"        callSid: req.body.CallSid,\n",{"type":39,"tag":145,"props":1096,"children":1097},{"class":147,"line":211},[1098],{"type":39,"tag":145,"props":1099,"children":1100},{},[1101],{"type":45,"value":1102},"        callStatus: req.body.CallStatus,\n",{"type":39,"tag":145,"props":1104,"children":1105},{"class":147,"line":220},[1106],{"type":39,"tag":145,"props":1107,"children":1108},{},[1109],{"type":45,"value":1110},"        timestamp: Date.now(),\n",{"type":39,"tag":145,"props":1112,"children":1113},{"class":147,"line":229},[1114],{"type":39,"tag":145,"props":1115,"children":1116},{},[1117],{"type":45,"value":1118},"    });\n",{"type":39,"tag":145,"props":1120,"children":1121},{"class":147,"line":238},[1122],{"type":39,"tag":145,"props":1123,"children":1124},{},[1125],{"type":45,"value":1126},"    res.sendStatus(200);  \u002F\u002F Respond FAST — Twilio will retry on timeout\n",{"type":39,"tag":145,"props":1128,"children":1129},{"class":147,"line":247},[1130],{"type":39,"tag":145,"props":1131,"children":1132},{},[1133],{"type":45,"value":1134},"});\n",{"type":39,"tag":145,"props":1136,"children":1137},{"class":147,"line":256},[1138],{"type":39,"tag":145,"props":1139,"children":1140},{"emptyLinePlaceholder":161},[1141],{"type":45,"value":164},{"type":39,"tag":145,"props":1143,"children":1144},{"class":147,"line":265},[1145],{"type":39,"tag":145,"props":1146,"children":1147},{},[1148],{"type":45,"value":1149},"\u002F\u002F Process asynchronously\n",{"type":39,"tag":145,"props":1151,"children":1152},{"class":147,"line":274},[1153],{"type":39,"tag":145,"props":1154,"children":1155},{},[1156],{"type":45,"value":1157},"const worker = new Worker(\"twilio-status\", async (job) => {\n",{"type":39,"tag":145,"props":1159,"children":1160},{"class":147,"line":283},[1161],{"type":39,"tag":145,"props":1162,"children":1163},{},[1164],{"type":45,"value":1165},"    const { callSid, callStatus } = job.data;\n",{"type":39,"tag":145,"props":1167,"children":1168},{"class":147,"line":292},[1169],{"type":39,"tag":145,"props":1170,"children":1171},{},[1172],{"type":45,"value":1173},"    await updateDatabase(callSid, callStatus);\n",{"type":39,"tag":145,"props":1175,"children":1176},{"class":147,"line":301},[1177],{"type":39,"tag":145,"props":1178,"children":1179},{},[1180],{"type":45,"value":1134},{"type":39,"tag":48,"props":1182,"children":1183},{},[1184],{"type":39,"tag":128,"props":1185,"children":1186},{},[1187],{"type":45,"value":1188},"Python (Flask + Celery)",{"type":39,"tag":134,"props":1190,"children":1192},{"className":136,"code":1191,"language":138,"meta":139,"style":139},"@app.route(\"\u002Fstatus\", methods=[\"POST\"])\ndef status_callback():\n    # Queue for async processing\n    process_status.delay(\n        call_sid=request.form[\"CallSid\"],\n        call_status=request.form[\"CallStatus\"]\n    )\n    return \"\", 200  # Respond FAST\n\n@celery.task\ndef process_status(call_sid, call_status):\n    update_database(call_sid, call_status)\n",[1193],{"type":39,"tag":89,"props":1194,"children":1195},{"__ignoreMap":139},[1196,1204,1212,1220,1228,1236,1244,1252,1260,1267,1275,1283],{"type":39,"tag":145,"props":1197,"children":1198},{"class":147,"line":148},[1199],{"type":39,"tag":145,"props":1200,"children":1201},{},[1202],{"type":45,"value":1203},"@app.route(\"\u002Fstatus\", methods=[\"POST\"])\n",{"type":39,"tag":145,"props":1205,"children":1206},{"class":147,"line":157},[1207],{"type":39,"tag":145,"props":1208,"children":1209},{},[1210],{"type":45,"value":1211},"def status_callback():\n",{"type":39,"tag":145,"props":1213,"children":1214},{"class":147,"line":167},[1215],{"type":39,"tag":145,"props":1216,"children":1217},{},[1218],{"type":45,"value":1219},"    # Queue for async processing\n",{"type":39,"tag":145,"props":1221,"children":1222},{"class":147,"line":176},[1223],{"type":39,"tag":145,"props":1224,"children":1225},{},[1226],{"type":45,"value":1227},"    process_status.delay(\n",{"type":39,"tag":145,"props":1229,"children":1230},{"class":147,"line":185},[1231],{"type":39,"tag":145,"props":1232,"children":1233},{},[1234],{"type":45,"value":1235},"        call_sid=request.form[\"CallSid\"],\n",{"type":39,"tag":145,"props":1237,"children":1238},{"class":147,"line":194},[1239],{"type":39,"tag":145,"props":1240,"children":1241},{},[1242],{"type":45,"value":1243},"        call_status=request.form[\"CallStatus\"]\n",{"type":39,"tag":145,"props":1245,"children":1246},{"class":147,"line":27},[1247],{"type":39,"tag":145,"props":1248,"children":1249},{},[1250],{"type":45,"value":1251},"    )\n",{"type":39,"tag":145,"props":1253,"children":1254},{"class":147,"line":211},[1255],{"type":39,"tag":145,"props":1256,"children":1257},{},[1258],{"type":45,"value":1259},"    return \"\", 200  # Respond FAST\n",{"type":39,"tag":145,"props":1261,"children":1262},{"class":147,"line":220},[1263],{"type":39,"tag":145,"props":1264,"children":1265},{"emptyLinePlaceholder":161},[1266],{"type":45,"value":164},{"type":39,"tag":145,"props":1268,"children":1269},{"class":147,"line":229},[1270],{"type":39,"tag":145,"props":1271,"children":1272},{},[1273],{"type":45,"value":1274},"@celery.task\n",{"type":39,"tag":145,"props":1276,"children":1277},{"class":147,"line":238},[1278],{"type":39,"tag":145,"props":1279,"children":1280},{},[1281],{"type":45,"value":1282},"def process_status(call_sid, call_status):\n",{"type":39,"tag":145,"props":1284,"children":1285},{"class":147,"line":247},[1286],{"type":39,"tag":145,"props":1287,"children":1288},{},[1289],{"type":45,"value":1290},"    update_database(call_sid, call_status)\n",{"type":39,"tag":48,"props":1292,"children":1293},{},[1294,1299,1301,1307],{"type":39,"tag":128,"props":1295,"children":1296},{},[1297],{"type":45,"value":1298},"Idempotency key:",{"type":45,"value":1300}," Use ",{"type":39,"tag":89,"props":1302,"children":1304},{"className":1303},[],[1305],{"type":45,"value":1306},"{CallSid}-{CallStatus}",{"type":45,"value":1308}," as a composite key. Twilio retries on timeout, which can cause duplicate callbacks. Deduplicate before processing.",{"type":39,"tag":113,"props":1310,"children":1312},{"id":1311},"_5-fallback-chains",[1313],{"type":45,"value":1314},"5. Fallback Chains",{"type":39,"tag":48,"props":1316,"children":1317},{},[1318],{"type":45,"value":1319},"When delivery on one channel fails, escalate to the next:",{"type":39,"tag":48,"props":1321,"children":1322},{},[1323],{"type":39,"tag":128,"props":1324,"children":1325},{},[1326],{"type":45,"value":132},{"type":39,"tag":134,"props":1328,"children":1330},{"className":136,"code":1329,"language":138,"meta":139,"style":139},"async def send_with_fallback(client, to, message, messaging_service_sid):\n    \"\"\"Try SMS → Voice → Email fallback chain.\"\"\"\n    \n    # Try SMS first\n    try:\n        msg = client.messages.create(\n            to=to, body=message, messaging_service_sid=messaging_service_sid,\n            status_callback=\"https:\u002F\u002Fyourapp.com\u002Fstatus\"\n        )\n        # Wait for delivery confirmation via StatusCallback\n        # If undelivered after timeout, fall through to voice\n        return {\"channel\": \"sms\", \"sid\": msg.sid}\n    except Exception:\n        pass  # SMS failed, try voice\n    \n    # Fallback to voice\n    try:\n        call = client.calls.create(\n            to=to, from_=\"+15551234567\",\n            twiml=f\"\u003CResponse>\u003CSay>{message}\u003C\u002FSay>\u003C\u002FResponse>\",\n            status_callback=\"https:\u002F\u002Fyourapp.com\u002Fcall-status\"\n        )\n        return {\"channel\": \"voice\", \"sid\": call.sid}\n    except Exception:\n        pass  # Voice failed, try email\n    \n    # Last resort: email\n    # Use SendGrid — see twilio-sendgrid-email\n    return {\"channel\": \"email\", \"status\": \"queued\"}\n",[1331],{"type":39,"tag":89,"props":1332,"children":1333},{"__ignoreMap":139},[1334,1342,1350,1357,1365,1373,1381,1389,1397,1405,1413,1421,1429,1437,1445,1452,1460,1467,1475,1483,1491,1499,1506,1514,1521,1529,1537,1546,1555],{"type":39,"tag":145,"props":1335,"children":1336},{"class":147,"line":148},[1337],{"type":39,"tag":145,"props":1338,"children":1339},{},[1340],{"type":45,"value":1341},"async def send_with_fallback(client, to, message, messaging_service_sid):\n",{"type":39,"tag":145,"props":1343,"children":1344},{"class":147,"line":157},[1345],{"type":39,"tag":145,"props":1346,"children":1347},{},[1348],{"type":45,"value":1349},"    \"\"\"Try SMS → Voice → Email fallback chain.\"\"\"\n",{"type":39,"tag":145,"props":1351,"children":1352},{"class":147,"line":167},[1353],{"type":39,"tag":145,"props":1354,"children":1355},{},[1356],{"type":45,"value":835},{"type":39,"tag":145,"props":1358,"children":1359},{"class":147,"line":176},[1360],{"type":39,"tag":145,"props":1361,"children":1362},{},[1363],{"type":45,"value":1364},"    # Try SMS first\n",{"type":39,"tag":145,"props":1366,"children":1367},{"class":147,"line":185},[1368],{"type":39,"tag":145,"props":1369,"children":1370},{},[1371],{"type":45,"value":1372},"    try:\n",{"type":39,"tag":145,"props":1374,"children":1375},{"class":147,"line":194},[1376],{"type":39,"tag":145,"props":1377,"children":1378},{},[1379],{"type":45,"value":1380},"        msg = client.messages.create(\n",{"type":39,"tag":145,"props":1382,"children":1383},{"class":147,"line":27},[1384],{"type":39,"tag":145,"props":1385,"children":1386},{},[1387],{"type":45,"value":1388},"            to=to, body=message, messaging_service_sid=messaging_service_sid,\n",{"type":39,"tag":145,"props":1390,"children":1391},{"class":147,"line":211},[1392],{"type":39,"tag":145,"props":1393,"children":1394},{},[1395],{"type":45,"value":1396},"            status_callback=\"https:\u002F\u002Fyourapp.com\u002Fstatus\"\n",{"type":39,"tag":145,"props":1398,"children":1399},{"class":147,"line":220},[1400],{"type":39,"tag":145,"props":1401,"children":1402},{},[1403],{"type":45,"value":1404},"        )\n",{"type":39,"tag":145,"props":1406,"children":1407},{"class":147,"line":229},[1408],{"type":39,"tag":145,"props":1409,"children":1410},{},[1411],{"type":45,"value":1412},"        # Wait for delivery confirmation via StatusCallback\n",{"type":39,"tag":145,"props":1414,"children":1415},{"class":147,"line":238},[1416],{"type":39,"tag":145,"props":1417,"children":1418},{},[1419],{"type":45,"value":1420},"        # If undelivered after timeout, fall through to voice\n",{"type":39,"tag":145,"props":1422,"children":1423},{"class":147,"line":247},[1424],{"type":39,"tag":145,"props":1425,"children":1426},{},[1427],{"type":45,"value":1428},"        return {\"channel\": \"sms\", \"sid\": msg.sid}\n",{"type":39,"tag":145,"props":1430,"children":1431},{"class":147,"line":256},[1432],{"type":39,"tag":145,"props":1433,"children":1434},{},[1435],{"type":45,"value":1436},"    except Exception:\n",{"type":39,"tag":145,"props":1438,"children":1439},{"class":147,"line":265},[1440],{"type":39,"tag":145,"props":1441,"children":1442},{},[1443],{"type":45,"value":1444},"        pass  # SMS failed, try voice\n",{"type":39,"tag":145,"props":1446,"children":1447},{"class":147,"line":274},[1448],{"type":39,"tag":145,"props":1449,"children":1450},{},[1451],{"type":45,"value":835},{"type":39,"tag":145,"props":1453,"children":1454},{"class":147,"line":283},[1455],{"type":39,"tag":145,"props":1456,"children":1457},{},[1458],{"type":45,"value":1459},"    # Fallback to voice\n",{"type":39,"tag":145,"props":1461,"children":1462},{"class":147,"line":292},[1463],{"type":39,"tag":145,"props":1464,"children":1465},{},[1466],{"type":45,"value":1372},{"type":39,"tag":145,"props":1468,"children":1469},{"class":147,"line":301},[1470],{"type":39,"tag":145,"props":1471,"children":1472},{},[1473],{"type":45,"value":1474},"        call = client.calls.create(\n",{"type":39,"tag":145,"props":1476,"children":1477},{"class":147,"line":310},[1478],{"type":39,"tag":145,"props":1479,"children":1480},{},[1481],{"type":45,"value":1482},"            to=to, from_=\"+15551234567\",\n",{"type":39,"tag":145,"props":1484,"children":1485},{"class":147,"line":319},[1486],{"type":39,"tag":145,"props":1487,"children":1488},{},[1489],{"type":45,"value":1490},"            twiml=f\"\u003CResponse>\u003CSay>{message}\u003C\u002FSay>\u003C\u002FResponse>\",\n",{"type":39,"tag":145,"props":1492,"children":1493},{"class":147,"line":328},[1494],{"type":39,"tag":145,"props":1495,"children":1496},{},[1497],{"type":45,"value":1498},"            status_callback=\"https:\u002F\u002Fyourapp.com\u002Fcall-status\"\n",{"type":39,"tag":145,"props":1500,"children":1501},{"class":147,"line":337},[1502],{"type":39,"tag":145,"props":1503,"children":1504},{},[1505],{"type":45,"value":1404},{"type":39,"tag":145,"props":1507,"children":1508},{"class":147,"line":346},[1509],{"type":39,"tag":145,"props":1510,"children":1511},{},[1512],{"type":45,"value":1513},"        return {\"channel\": \"voice\", \"sid\": call.sid}\n",{"type":39,"tag":145,"props":1515,"children":1516},{"class":147,"line":556},[1517],{"type":39,"tag":145,"props":1518,"children":1519},{},[1520],{"type":45,"value":1436},{"type":39,"tag":145,"props":1522,"children":1523},{"class":147,"line":23},[1524],{"type":39,"tag":145,"props":1525,"children":1526},{},[1527],{"type":45,"value":1528},"        pass  # Voice failed, try email\n",{"type":39,"tag":145,"props":1530,"children":1532},{"class":147,"line":1531},26,[1533],{"type":39,"tag":145,"props":1534,"children":1535},{},[1536],{"type":45,"value":835},{"type":39,"tag":145,"props":1538,"children":1540},{"class":147,"line":1539},27,[1541],{"type":39,"tag":145,"props":1542,"children":1543},{},[1544],{"type":45,"value":1545},"    # Last resort: email\n",{"type":39,"tag":145,"props":1547,"children":1549},{"class":147,"line":1548},28,[1550],{"type":39,"tag":145,"props":1551,"children":1552},{},[1553],{"type":45,"value":1554},"    # Use SendGrid — see twilio-sendgrid-email\n",{"type":39,"tag":145,"props":1556,"children":1558},{"class":147,"line":1557},29,[1559],{"type":39,"tag":145,"props":1560,"children":1561},{},[1562],{"type":45,"value":1563},"    return {\"channel\": \"email\", \"status\": \"queued\"}\n",{"type":39,"tag":113,"props":1565,"children":1567},{"id":1566},"_6-voice-concurrency-limits",[1568],{"type":45,"value":1569},"6. Voice Concurrency Limits",{"type":39,"tag":611,"props":1571,"children":1572},{},[1573,1593],{"type":39,"tag":615,"props":1574,"children":1575},{},[1576],{"type":39,"tag":619,"props":1577,"children":1578},{},[1579,1584,1589],{"type":39,"tag":623,"props":1580,"children":1581},{},[1582],{"type":45,"value":1583},"Resource",{"type":39,"tag":623,"props":1585,"children":1586},{},[1587],{"type":45,"value":1588},"Default limit",{"type":39,"tag":623,"props":1590,"children":1591},{},[1592],{"type":45,"value":642},{"type":39,"tag":644,"props":1594,"children":1595},{},[1596,1614,1632,1648],{"type":39,"tag":619,"props":1597,"children":1598},{},[1599,1604,1609],{"type":39,"tag":651,"props":1600,"children":1601},{},[1602],{"type":45,"value":1603},"Concurrent calls per account",{"type":39,"tag":651,"props":1605,"children":1606},{},[1607],{"type":45,"value":1608},"1 (trial) \u002F variable (paid)",{"type":39,"tag":651,"props":1610,"children":1611},{},[1612],{"type":45,"value":1613},"Request increase via support",{"type":39,"tag":619,"props":1615,"children":1616},{},[1617,1622,1627],{"type":39,"tag":651,"props":1618,"children":1619},{},[1620],{"type":45,"value":1621},"Calls per second (CPS)",{"type":39,"tag":651,"props":1623,"children":1624},{},[1625],{"type":45,"value":1626},"1 CPS (default)",{"type":39,"tag":651,"props":1628,"children":1629},{},[1630],{"type":45,"value":1631},"Increase via support for outbound campaigns",{"type":39,"tag":619,"props":1633,"children":1634},{},[1635,1640,1645],{"type":39,"tag":651,"props":1636,"children":1637},{},[1638],{"type":45,"value":1639},"Conference participants",{"type":39,"tag":651,"props":1641,"children":1642},{},[1643],{"type":45,"value":1644},"250 per conference",{"type":39,"tag":651,"props":1646,"children":1647},{},[],{"type":39,"tag":619,"props":1649,"children":1650},{},[1651,1656,1661],{"type":39,"tag":651,"props":1652,"children":1653},{},[1654],{"type":45,"value":1655},"Twilio Functions concurrent",{"type":39,"tag":651,"props":1657,"children":1658},{},[1659],{"type":45,"value":1660},"30 per service",{"type":39,"tag":651,"props":1662,"children":1663},{},[1664],{"type":45,"value":1665},"Use thin-receiver pattern above",{"type":39,"tag":48,"props":1667,"children":1668},{},[1669],{"type":45,"value":1670},"For outbound campaigns, request CPS increase before launch — not during.",{"type":39,"tag":113,"props":1672,"children":1674},{"id":1673},"_7-webhook-timeout-handling",[1675],{"type":45,"value":1676},"7. Webhook Timeout Handling",{"type":39,"tag":48,"props":1678,"children":1679},{},[1680,1682,1687,1689,1693],{"type":45,"value":1681},"Twilio expects a response within ",{"type":39,"tag":128,"props":1683,"children":1684},{},[1685],{"type":45,"value":1686},"15 seconds",{"type":45,"value":1688}," for voice webhooks and ",{"type":39,"tag":128,"props":1690,"children":1691},{},[1692],{"type":45,"value":1686},{"type":45,"value":1694}," for messaging webhooks. If your endpoint doesn't respond:",{"type":39,"tag":69,"props":1696,"children":1697},{},[1698,1709],{"type":39,"tag":73,"props":1699,"children":1700},{},[1701,1703],{"type":45,"value":1702},"Voice: Twilio hangs up or falls back to ",{"type":39,"tag":89,"props":1704,"children":1706},{"className":1705},[],[1707],{"type":45,"value":1708},"voiceFallbackUrl",{"type":39,"tag":73,"props":1710,"children":1711},{},[1712],{"type":45,"value":1713},"Messaging: Twilio retries the callback",{"type":39,"tag":48,"props":1715,"children":1716},{},[1717],{"type":39,"tag":128,"props":1718,"children":1719},{},[1720],{"type":45,"value":1721},"Always configure fallback URLs:",{"type":39,"tag":134,"props":1723,"children":1725},{"className":136,"code":1724,"language":138,"meta":139,"style":139},"# On phone number configuration\nnumber = client.incoming_phone_numbers(phone_sid).update(\n    voice_url=\"https:\u002F\u002Fyourapp.com\u002Fvoice\",\n    voice_fallback_url=\"https:\u002F\u002Fyourapp.com\u002Fvoice-fallback\",  # backup endpoint\n    sms_url=\"https:\u002F\u002Fyourapp.com\u002Fsms\",\n    sms_fallback_url=\"https:\u002F\u002Fyourapp.com\u002Fsms-fallback\"\n)\n",[1726],{"type":39,"tag":89,"props":1727,"children":1728},{"__ignoreMap":139},[1729,1737,1745,1753,1761,1769,1777],{"type":39,"tag":145,"props":1730,"children":1731},{"class":147,"line":148},[1732],{"type":39,"tag":145,"props":1733,"children":1734},{},[1735],{"type":45,"value":1736},"# On phone number configuration\n",{"type":39,"tag":145,"props":1738,"children":1739},{"class":147,"line":157},[1740],{"type":39,"tag":145,"props":1741,"children":1742},{},[1743],{"type":45,"value":1744},"number = client.incoming_phone_numbers(phone_sid).update(\n",{"type":39,"tag":145,"props":1746,"children":1747},{"class":147,"line":167},[1748],{"type":39,"tag":145,"props":1749,"children":1750},{},[1751],{"type":45,"value":1752},"    voice_url=\"https:\u002F\u002Fyourapp.com\u002Fvoice\",\n",{"type":39,"tag":145,"props":1754,"children":1755},{"class":147,"line":176},[1756],{"type":39,"tag":145,"props":1757,"children":1758},{},[1759],{"type":45,"value":1760},"    voice_fallback_url=\"https:\u002F\u002Fyourapp.com\u002Fvoice-fallback\",  # backup endpoint\n",{"type":39,"tag":145,"props":1762,"children":1763},{"class":147,"line":185},[1764],{"type":39,"tag":145,"props":1765,"children":1766},{},[1767],{"type":45,"value":1768},"    sms_url=\"https:\u002F\u002Fyourapp.com\u002Fsms\",\n",{"type":39,"tag":145,"props":1770,"children":1771},{"class":147,"line":194},[1772],{"type":39,"tag":145,"props":1773,"children":1774},{},[1775],{"type":45,"value":1776},"    sms_fallback_url=\"https:\u002F\u002Fyourapp.com\u002Fsms-fallback\"\n",{"type":39,"tag":145,"props":1778,"children":1779},{"class":147,"line":27},[1780],{"type":39,"tag":145,"props":1781,"children":1782},{},[1783],{"type":45,"value":1784},")\n",{"type":39,"tag":59,"props":1786,"children":1787},{},[],{"type":39,"tag":40,"props":1789,"children":1791},{"id":1790},"monitoring-checklist",[1792],{"type":45,"value":1793},"Monitoring Checklist",{"type":39,"tag":48,"props":1795,"children":1796},{},[1797],{"type":45,"value":1798},"Set up these alerts before going to production:",{"type":39,"tag":611,"props":1800,"children":1801},{},[1802,1823],{"type":39,"tag":615,"props":1803,"children":1804},{},[1805],{"type":39,"tag":619,"props":1806,"children":1807},{},[1808,1813,1818],{"type":39,"tag":623,"props":1809,"children":1810},{},[1811],{"type":45,"value":1812},"Metric",{"type":39,"tag":623,"props":1814,"children":1815},{},[1816],{"type":45,"value":1817},"Alert threshold",{"type":39,"tag":623,"props":1819,"children":1820},{},[1821],{"type":45,"value":1822},"How to track",{"type":39,"tag":644,"props":1824,"children":1825},{},[1826,1844,1878,1896,1914],{"type":39,"tag":619,"props":1827,"children":1828},{},[1829,1834,1839],{"type":39,"tag":651,"props":1830,"children":1831},{},[1832],{"type":45,"value":1833},"429 error rate",{"type":39,"tag":651,"props":1835,"children":1836},{},[1837],{"type":45,"value":1838},"> 5% of requests",{"type":39,"tag":651,"props":1840,"children":1841},{},[1842],{"type":45,"value":1843},"Count 429s in your backoff handler",{"type":39,"tag":619,"props":1845,"children":1846},{},[1847,1852,1857],{"type":39,"tag":651,"props":1848,"children":1849},{},[1850],{"type":45,"value":1851},"Delivery failure rate",{"type":39,"tag":651,"props":1853,"children":1854},{},[1855],{"type":45,"value":1856},"> 2% of messages",{"type":39,"tag":651,"props":1858,"children":1859},{},[1860,1862,1868,1870,1876],{"type":45,"value":1861},"StatusCallback ",{"type":39,"tag":89,"props":1863,"children":1865},{"className":1864},[],[1866],{"type":45,"value":1867},"failed",{"type":45,"value":1869},"\u002F",{"type":39,"tag":89,"props":1871,"children":1873},{"className":1872},[],[1874],{"type":45,"value":1875},"undelivered",{"type":45,"value":1877}," events",{"type":39,"tag":619,"props":1879,"children":1880},{},[1881,1886,1891],{"type":39,"tag":651,"props":1882,"children":1883},{},[1884],{"type":45,"value":1885},"Webhook response time",{"type":39,"tag":651,"props":1887,"children":1888},{},[1889],{"type":45,"value":1890},"> 5 seconds p95",{"type":39,"tag":651,"props":1892,"children":1893},{},[1894],{"type":45,"value":1895},"Your APM tool (DataDog, New Relic)",{"type":39,"tag":619,"props":1897,"children":1898},{},[1899,1904,1909],{"type":39,"tag":651,"props":1900,"children":1901},{},[1902],{"type":45,"value":1903},"Queue depth",{"type":39,"tag":651,"props":1905,"children":1906},{},[1907],{"type":45,"value":1908},"Growing over 5 minutes",{"type":39,"tag":651,"props":1910,"children":1911},{},[1912],{"type":45,"value":1913},"Your message queue metrics",{"type":39,"tag":619,"props":1915,"children":1916},{},[1917,1922,1927],{"type":39,"tag":651,"props":1918,"children":1919},{},[1920],{"type":45,"value":1921},"Concurrent calls",{"type":39,"tag":651,"props":1923,"children":1924},{},[1925],{"type":45,"value":1926},"> 80% of limit",{"type":39,"tag":651,"props":1928,"children":1929},{},[1930],{"type":45,"value":1931},"Twilio Usage API or Event Streams",{"type":39,"tag":48,"props":1933,"children":1934},{},[1935],{"type":45,"value":1936},"Twilio's built-in alerting systems are under-used — end-users often discover issues before developers do. Configure StatusCallbacks + Event Streams for delivery failure alerts on every integration.",{"type":39,"tag":59,"props":1938,"children":1939},{},[],{"type":39,"tag":40,"props":1941,"children":1943},{"id":1942},"cannot",[1944],{"type":45,"value":1945},"CANNOT",{"type":39,"tag":69,"props":1947,"children":1948},{},[1949,1959,1969,1979,1989],{"type":39,"tag":73,"props":1950,"children":1951},{},[1952,1957],{"type":39,"tag":128,"props":1953,"children":1954},{},[1955],{"type":45,"value":1956},"Cannot avoid 429 errors on any Twilio API",{"type":45,"value":1958}," — Backoff patterns apply to all APIs (Messaging, Voice, Verify, Lookup)",{"type":39,"tag":73,"props":1960,"children":1961},{},[1962,1967],{"type":39,"tag":128,"props":1963,"children":1964},{},[1965],{"type":45,"value":1966},"Cannot increase per-number throughput",{"type":45,"value":1968}," — Add more numbers via Messaging Services instead",{"type":39,"tag":73,"props":1970,"children":1971},{},[1972,1977],{"type":39,"tag":128,"props":1973,"children":1974},{},[1975],{"type":45,"value":1976},"Cannot configure StatusCallback retry behavior",{"type":45,"value":1978}," — Twilio retries on timeout automatically; not configurable",{"type":39,"tag":73,"props":1980,"children":1981},{},[1982,1987],{"type":39,"tag":128,"props":1983,"children":1984},{},[1985],{"type":45,"value":1986},"Cannot exceed Twilio Functions limits",{"type":45,"value":1988}," — 30 concurrent executions\u002Fservice, 10-second timeout, 256 MB memory",{"type":39,"tag":73,"props":1990,"children":1991},{},[1992,1997],{"type":39,"tag":128,"props":1993,"children":1994},{},[1995],{"type":45,"value":1996},"Cannot use a native Twilio rate limiting API",{"type":45,"value":1998}," — You must implement rate limiting in your application",{"type":39,"tag":59,"props":2000,"children":2001},{},[],{"type":39,"tag":40,"props":2003,"children":2005},{"id":2004},"next-steps",[2006],{"type":45,"value":2007},"Next Steps",{"type":39,"tag":69,"props":2009,"children":2010},{},[2011,2026,2042,2057],{"type":39,"tag":73,"props":2012,"children":2013},{},[2014,2019,2021],{"type":39,"tag":128,"props":2015,"children":2016},{},[2017],{"type":45,"value":2018},"Messaging at scale:",{"type":45,"value":2020}," ",{"type":39,"tag":89,"props":2022,"children":2024},{"className":2023},[],[2025],{"type":45,"value":94},{"type":39,"tag":73,"props":2027,"children":2028},{},[2029,2034,2035,2040],{"type":39,"tag":128,"props":2030,"children":2031},{},[2032],{"type":45,"value":2033},"Monitor delivery:",{"type":45,"value":2020},{"type":39,"tag":89,"props":2036,"children":2038},{"className":2037},[],[2039],{"type":45,"value":102},{"type":45,"value":2041}," (StatusCallbacks)",{"type":39,"tag":73,"props":2043,"children":2044},{},[2045,2050,2051],{"type":39,"tag":128,"props":2046,"children":2047},{},[2048],{"type":45,"value":2049},"Debug failures:",{"type":45,"value":2020},{"type":39,"tag":89,"props":2052,"children":2054},{"className":2053},[],[2055],{"type":45,"value":2056},"twilio-debugging-observability",{"type":39,"tag":73,"props":2058,"children":2059},{},[2060,2065,2066],{"type":39,"tag":128,"props":2061,"children":2062},{},[2063],{"type":45,"value":2064},"Compliance for bulk sends:",{"type":45,"value":2020},{"type":39,"tag":89,"props":2067,"children":2069},{"className":2068},[],[2070],{"type":45,"value":2071},"twilio-compliance-traffic",{"type":39,"tag":2073,"props":2074,"children":2075},"style",{},[2076],{"type":45,"value":2077},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":2079,"total":2185},[2080,2094,2114,2125,2137,2152,2169],{"slug":2081,"name":2081,"fn":2082,"description":2083,"org":2084,"tags":2085,"stars":23,"repoUrl":24,"updatedAt":2093},"twilio-account-setup","configure Twilio accounts and credentials","Create and configure a Twilio account from scratch. Covers free trial signup, trial limitations, getting credentials (Account SID and Auth Token), buying a phone number, verifying recipient numbers for trial use, SDK installation, first API call, subaccount management (creation, inheritance, credential isolation, limits), and enabling specific products (AI Assistants, Conversations, Verify, ConversationRelay, WhatsApp). Use this skill before any other Twilio skill if you do not yet have a Twilio account or need to enable a product. For Organization-level governance (SSO, SCIM, multi-team), see `twilio-organizations-setup`.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2086,2087,2090],{"name":20,"slug":21,"type":15},{"name":2088,"slug":2089,"type":15},"Communications","communications",{"name":2091,"slug":2092,"type":15},"SMS","sms","2026-08-01T05:43:28.968968",{"slug":2095,"name":2095,"fn":2096,"description":2097,"org":2098,"tags":2099,"stars":23,"repoUrl":24,"updatedAt":2113},"twilio-agent-augmentation-architect","augment human agents with AI intelligence","Planning skill for augmenting human agents with real-time AI intelligence. Qualifies the developer's use case across coaching, compliance, QA, and routing to recommend the right Conversation Intelligence + Conversation Memory + TaskRouter architecture. Handles both \"I want to add AI coaching to my call center\" and \"configure Conversation Intelligence operators for script adherence.\"\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2100,2103,2106,2109,2112],{"name":2101,"slug":2102,"type":15},"Agents","agents",{"name":2104,"slug":2105,"type":15},"AI","ai",{"name":2107,"slug":2108,"type":15},"Coaching","coaching",{"name":2110,"slug":2111,"type":15},"QA","qa",{"name":9,"slug":8,"type":15},"2026-07-17T06:07:58.250609",{"slug":2115,"name":2115,"fn":2116,"description":2117,"org":2118,"tags":2119,"stars":23,"repoUrl":24,"updatedAt":2124},"twilio-agent-connect","connect AI agents to Twilio channels","Connect third-party AI agents (OpenAI, Bedrock, LangChain, Microsoft Foundry) to Twilio's communication channels using the Twilio Agent Connect SDK. Covers identity resolution, memory and context management via Conversation Memory, conversation orchestration via Conversation Orchestrator, multi-channel handling (Voice, SMS, RCS, WhatsApp, Chat), and AI-to-human escalation. Use this skill when integrating an existing LLM agent with Twilio services.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2120,2121,2122,2123],{"name":2101,"slug":2102,"type":15},{"name":20,"slug":21,"type":15},{"name":2088,"slug":2089,"type":15},{"name":9,"slug":8,"type":15},"2026-07-17T06:06:05.217098",{"slug":2126,"name":2126,"fn":2127,"description":2128,"org":2129,"tags":2130,"stars":23,"repoUrl":24,"updatedAt":2136},"twilio-ai-agent-architect","plan Twilio conversational AI agents","Planning skill for AI-powered conversational agents. Qualifies the developer's use case across outcome sophistication, entry point, and customer profile to recommend the right Twilio Conversations architecture and implementation skills. Handles both high-level requests (\"build me a voice AI assistant\") and specific ones (\"integrate ConversationRelay with my OpenAI backend\").\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2131,2132,2135],{"name":2101,"slug":2102,"type":15},{"name":2133,"slug":2134,"type":15},"Architecture","architecture",{"name":9,"slug":8,"type":15},"2026-07-17T06:07:48.883723",{"slug":2138,"name":2138,"fn":2139,"description":2140,"org":2141,"tags":2142,"stars":23,"repoUrl":24,"updatedAt":2151},"twilio-call-recordings","record and manage Twilio voice calls","Record Twilio voice calls correctly. Covers the critical distinction between Record verb (voicemail) and Dial record (call recording), dual-channel for QA, mid-call pause for PCI, Conference recording, and the ConversationRelay workaround. Use this skill whenever you need to capture call audio for compliance, QA, or analytics.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2143,2146,2149,2150],{"name":2144,"slug":2145,"type":15},"Audio","audio",{"name":2147,"slug":2148,"type":15},"Compliance","compliance",{"name":2110,"slug":2111,"type":15},{"name":9,"slug":8,"type":15},"2026-07-17T06:07:55.268412",{"slug":2153,"name":2153,"fn":2154,"description":2155,"org":2156,"tags":2157,"stars":23,"repoUrl":24,"updatedAt":2168},"twilio-cli-reference","manage Twilio resources via CLI","Twilio CLI reference for managing Twilio resources from the terminal. Covers installation, credential profiles, phone number provisioning, sending SMS and email, webhook configuration, local development with a tunneling service, debugging with watch and logs, serverless deployment, and plugin ecosystem. Use when the developer asks to \"just do it\", \"set this up\", \"run a command\", mentions \"CLI\", \"command line\", or \"terminal\", or when an AI agent can execute a task directly instead of writing application code.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2158,2161,2164,2167],{"name":2159,"slug":2160,"type":15},"CLI","cli",{"name":2162,"slug":2163,"type":15},"Local Development","local-development",{"name":2165,"slug":2166,"type":15},"Operations","operations",{"name":9,"slug":8,"type":15},"2026-07-17T06:07:54.925664",{"slug":2170,"name":2170,"fn":2171,"description":2172,"org":2173,"tags":2174,"stars":23,"repoUrl":24,"updatedAt":2184},"twilio-compliance-onboarding","manage Twilio messaging and voice compliance","Registrations required BEFORE Twilio traffic works. Covers messaging programs (A2P 10DLC, toll-free verification, WhatsApp WABA, RCS, short code, alphanumeric sender) and voice trust programs (STIR\u002FSHAKEN, Voice Integrity, Branded Calling, CNAM). Each number\u002Fsender type has its own program — registration blocks traffic until complete.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2175,2176,2179,2180,2181],{"name":2147,"slug":2148,"type":15},{"name":2177,"slug":2178,"type":15},"Messaging","messaging",{"name":2091,"slug":2092,"type":15},{"name":9,"slug":8,"type":15},{"name":2182,"slug":2183,"type":15},"WhatsApp","whatsapp","2026-07-17T06:05:47.897229",57,{"items":2187,"total":2185},[2188,2194,2202,2209,2215,2222,2229,2237,2252,2265,2281,2299],{"slug":2081,"name":2081,"fn":2082,"description":2083,"org":2189,"tags":2190,"stars":23,"repoUrl":24,"updatedAt":2093},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2191,2192,2193],{"name":20,"slug":21,"type":15},{"name":2088,"slug":2089,"type":15},{"name":2091,"slug":2092,"type":15},{"slug":2095,"name":2095,"fn":2096,"description":2097,"org":2195,"tags":2196,"stars":23,"repoUrl":24,"updatedAt":2113},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2197,2198,2199,2200,2201],{"name":2101,"slug":2102,"type":15},{"name":2104,"slug":2105,"type":15},{"name":2107,"slug":2108,"type":15},{"name":2110,"slug":2111,"type":15},{"name":9,"slug":8,"type":15},{"slug":2115,"name":2115,"fn":2116,"description":2117,"org":2203,"tags":2204,"stars":23,"repoUrl":24,"updatedAt":2124},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2205,2206,2207,2208],{"name":2101,"slug":2102,"type":15},{"name":20,"slug":21,"type":15},{"name":2088,"slug":2089,"type":15},{"name":9,"slug":8,"type":15},{"slug":2126,"name":2126,"fn":2127,"description":2128,"org":2210,"tags":2211,"stars":23,"repoUrl":24,"updatedAt":2136},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2212,2213,2214],{"name":2101,"slug":2102,"type":15},{"name":2133,"slug":2134,"type":15},{"name":9,"slug":8,"type":15},{"slug":2138,"name":2138,"fn":2139,"description":2140,"org":2216,"tags":2217,"stars":23,"repoUrl":24,"updatedAt":2151},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2218,2219,2220,2221],{"name":2144,"slug":2145,"type":15},{"name":2147,"slug":2148,"type":15},{"name":2110,"slug":2111,"type":15},{"name":9,"slug":8,"type":15},{"slug":2153,"name":2153,"fn":2154,"description":2155,"org":2223,"tags":2224,"stars":23,"repoUrl":24,"updatedAt":2168},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2225,2226,2227,2228],{"name":2159,"slug":2160,"type":15},{"name":2162,"slug":2163,"type":15},{"name":2165,"slug":2166,"type":15},{"name":9,"slug":8,"type":15},{"slug":2170,"name":2170,"fn":2171,"description":2172,"org":2230,"tags":2231,"stars":23,"repoUrl":24,"updatedAt":2184},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2232,2233,2234,2235,2236],{"name":2147,"slug":2148,"type":15},{"name":2177,"slug":2178,"type":15},{"name":2091,"slug":2092,"type":15},{"name":9,"slug":8,"type":15},{"name":2182,"slug":2183,"type":15},{"slug":2071,"name":2071,"fn":2238,"description":2239,"org":2240,"tags":2241,"stars":23,"repoUrl":24,"updatedAt":2251},"ensure compliance for Twilio messaging traffic","Rules you must follow for Twilio messaging and voice traffic. Covers TCPA (consent tiers, quiet hours, DNC), GDPR (EU consent, right to deletion), PCI DSS (payment recording, Pay verb), HIPAA (BAA, PHI), FDCPA (debt collection limits), CAN-SPAM, WhatsApp policies, SHAKEN\u002FSTIR, and consent management patterns. Use this skill proactively when developers have working traffic to ensure they follow the rules.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2242,2243,2244,2247,2250],{"name":2147,"slug":2148,"type":15},{"name":2177,"slug":2178,"type":15},{"name":2245,"slug":2246,"type":15},"Regulatory Compliance","regulatory-compliance",{"name":2248,"slug":2249,"type":15},"Security","security",{"name":9,"slug":8,"type":15},"2026-07-17T06:07:55.952779",{"slug":2253,"name":2253,"fn":2254,"description":2255,"org":2256,"tags":2257,"stars":23,"repoUrl":24,"updatedAt":2264},"twilio-conference-calls","build multi-party calls with Twilio Conference","Build multi-party calls using Twilio Conference. Covers warm transfer, cold transfer, coaching (whisper), hold vs mute, participant modes, and supervisor barge. Use this skill for any contact center, support line, or scenario requiring transfers, holds, or multi-party calls.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2258,2259,2260,2263],{"name":2144,"slug":2145,"type":15},{"name":2088,"slug":2089,"type":15},{"name":2261,"slug":2262,"type":15},"Meetings","meetings",{"name":9,"slug":8,"type":15},"2026-07-17T06:07:55.603708",{"slug":2266,"name":2266,"fn":2267,"description":2268,"org":2269,"tags":2270,"stars":23,"repoUrl":24,"updatedAt":2280},"twilio-content-template-builder","create and send message templates with Twilio","Create, manage, and send message templates using Twilio's Content API. Covers template creation for WhatsApp, SMS, RCS, and MMS; variable usage; WhatsApp Meta approval; and sending templates via ContentSid. Use this skill when building structured messages that require pre-approval or consistent formatting across channels.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2271,2274,2275,2276,2279],{"name":2272,"slug":2273,"type":15},"Email","email",{"name":2177,"slug":2178,"type":15},{"name":2091,"slug":2092,"type":15},{"name":2277,"slug":2278,"type":15},"Templates","templates",{"name":9,"slug":8,"type":15},"2026-07-17T06:04:26.637309",{"slug":2282,"name":2282,"fn":2283,"description":2284,"org":2285,"tags":2286,"stars":23,"repoUrl":24,"updatedAt":2298},"twilio-conversation-intelligence","build conversation intelligence pipelines","Twilio Conversation Intelligence development guide. Use when building real-time or post-call conversation analysis, language operator pipelines, sentiment analysis, agent assist, cross-channel analytics, or querying aggregated conversation insights (sentiment trends, escalation rates, dashboards).",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2287,2288,2291,2294,2297],{"name":2101,"slug":2102,"type":15},{"name":2289,"slug":2290,"type":15},"Analytics","analytics",{"name":2292,"slug":2293,"type":15},"Monitoring","monitoring",{"name":2295,"slug":2296,"type":15},"NLP","nlp",{"name":9,"slug":8,"type":15},"2026-07-17T06:07:52.545387",{"slug":2300,"name":2300,"fn":2301,"description":2302,"org":2303,"tags":2304,"stars":23,"repoUrl":24,"updatedAt":2310},"twilio-conversation-memory","manage conversation memory with Twilio","Store and retrieve conversation context using Twilio Conversation Memory. Covers Memory Store provisioning, profile management, traits, observations, conversation summaries, and semantic Recall. Use this skill to give AI agents or human agents persistent memory of conversations across sessions and channels.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2305,2306,2309],{"name":2101,"slug":2102,"type":15},{"name":2307,"slug":2308,"type":15},"Memory","memory",{"name":9,"slug":8,"type":15},"2026-07-17T06:04:19.526724"]