Twilio webhooks: usage spikes and Debugger errors as signals

Point Twilio's usage triggers and Debugger webhook at a Pulso webhook source, checked with your account's signature, and turn spend spikes and delivery errors into signals with a playbook.

Twilio bills by use, so a bug or an SMS pumping attack shows up first as spend. Usage triggers call a URL when a usage category passes a value you set, and the Debugger calls one for each error it logs. Point both at a Pulso webhook source and each becomes a signal with the steps to follow.

Connect Twilio#

Add Twilio to Pulso to create a webhook source called Twilio; it shows these steps with the source’s URL and takes your Auth Token to check signatures, then creates the monitors below that you pick, with their playbooks and a report. To start from scratch instead, create a webhook data source called Twilio.

  1. In the Twilio Console, copy the Auth Token under Account Info and paste it as the source’s signing secret: below these steps in Add to Pulso, or from scratch in its signature settings with the Twilio scheme. Twilio signs every request it sends with it.
  2. In the Console’s Usage Triggers, under Billing and Usage > Usage and Spend, create a trigger that calls the source’s Endpoint URL, https://hooks.pulso.run/webhooks/<id>/<token>, by POST. Add one for each category and threshold you want to hear about.

    With the Twilio CLI
    twilio api:core:usage:triggers:create --usage-category totalprice --trigger-by price --trigger-value 50 --recurring daily --callback-url https://hooks.pulso.run/webhooks/<id>/<token>
    
  3. In the Console’s Debugger, set the same URL as its webhook to get each error and warning it logs.

What arrives#

Both send form fields, which become columns as they are named. A usage trigger sends:

Column Example
UsageTriggerSid UT33c6aeeba34e48f38d6899ea5b765ad4
UsageCategory totalprice
TriggerBy price, count or usage
TriggerValue 50
CurrentValue 52.31
Recurring daily, monthly, yearly, alltime, or empty for a trigger that fires once
DateFired when it fired
AccountSid, UsageRecordUri, IdempotencyToken the account, the usage record to read and the delivery’s id

The Debugger sends Sid, AccountSid, Timestamp, Level (ERROR or WARNING), PayloadType and Payload, a JSON string with the error_code, the resource_sid it’s about and, for a webhook of yours that failed, the request and response.

Monitors to build#

Usage over its trigger#

Twilio errors#

Limits#

Sources: Twilio’s Usage triggers, Webhooks security and Debugging events webhook.


Add Twilio to Pulso: a webhook source, 2 monitors with their playbooks and a report, then these steps with the source's URL.

Add to Pulso

See the monitors, their playbooks and the report