---
title: "Track what happened to each text · Agent Wranglers"
url: https://agentwranglers.se/playbook/notifications/text-messages/sms-delivery-status
updated: 2026-10-20
licence: "All rights reserved"
---

# Track what happened to each text

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

- Level: Recommended
- Chapter: [Text messages](https://agentwranglers.se/playbook/notifications/text-messages)
- Rule: Record the provider's delivery status for every text through a signed callback, and stop sending to numbers that keep failing.
- How: Pass a status callback address with each send and verify its signature, as in [verify webhook signatures](https://agentwranglers.se/playbook/api-design/webhooks-and-events/signed-webhooks). Store the provider's message ID, status, error code and cost against the send. Do not retry a text marked undelivered for an invalid or unreachable number. Suppress a number after 3 such failures in a row. Watch daily cost per country next to the pumping alerts.
- Check: Send to a provider test number that always fails. The send row shows the failure code, and after the third failure the number is suppressed.

Example:

```js
app.post('/sms/status', verifyProviderSignature, async (req, res) => {
  const { MessageSid, MessageStatus, ErrorCode, To } = req.body;
  await db.sends.updateStatus(MessageSid, MessageStatus, ErrorCode);
  if (MessageStatus === 'undelivered' && (await db.sends.recentFailures(To)) >= 3) await db.smsSuppressions.add(To);
  res.sendStatus(204);
});
```

```python
@app.post("/sms/status")
def sms_status():
    verify_provider_signature(request)
    form = request.form
    db.sends.update_status(form["MessageSid"], form["MessageStatus"], form.get("ErrorCode"))
    if form["MessageStatus"] == "undelivered" and db.sends.recent_failures(form["To"]) >= 3:
        db.sms_suppressions.add(form["To"])
    return "", 204
```

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers notifications playbook: https://agentwranglers.se/playbook/notifications/text-messages/sms-delivery-status`.

- Previous: [Keep each text to one segment](https://agentwranglers.se/playbook/notifications/text-messages/sms-segments)
- [Text messages](https://agentwranglers.se/playbook/notifications/text-messages)
