Twilio
Send SMS and WhatsApp messages via Twilio from a workflow.
Use Twilio when you need to send outbound messages:
- Send SMS notifications (alerts, OTPs, confirmations)
- Send WhatsApp messages to customers within the 24-hour service window
- Notify users of workflow events (payment received, order shipped, etc.)
Connect a Twilio node to an AI Agent Tools handle to let the agent send notifications or alerts on demand.
| Handle | Type | Description |
|---|---|---|
input | any | Upstream data for {{ input.field }} template references in settings. |
| Handle | Type | Description |
|---|---|---|
result | object | Twilio message result |
The result (accessed as {{ twilio.* }}) shape:
| Field | Type | Description |
|---|---|---|
success | boolean | Whether the message was sent successfully |
sid | string | Twilio message SID (e.g. SM...) |
status | string | Message status (e.g. queued, sent, delivered) |
error | string | Error message if success is false |
{
"success": true,
"sid": "SMabc123def456",
"status": "queued",
"error": null
}
Each node run executes a single operation. Set Operation, then configure the message fields.
| Setting | Type | Default | Description |
|---|---|---|---|
operation | enum | send_sms | Messaging action to perform: send_sms or send_whatsapp. |
| Setting | Type | Default | Description |
|---|---|---|---|
allowed_operations | multi-select | All operations | Which operations are available when this plugin is used as an AI agent tool. Excluded from the tool schema — the agent can only invoke operations in this list. |
Shown when operation is send_sms:
| Setting | Type | Default | Description |
|---|---|---|---|
to | string | — | Recipient phone number in E.164 format (e.g. +14155559876). Required. Supports {{ }} bindings. |
body | code editor | — | Message text. Required. Supports {{ }} bindings. |
Shown when operation is send_whatsapp:
| Setting | Type | Default | Description |
|---|---|---|---|
to | string | — | Recipient WhatsApp number in E.164 format (Twilio adds the whatsapp: prefix). Required. Supports {{ }} bindings. |
body | code editor | — | Message text. Must comply with WhatsApp messaging rules. Required. Supports {{ }} bindings. |
Configure on the Environment Variables page:
| Variable | Description |
|---|---|
TWILIO_ACCOUNT_SID | Twilio Account SID (starts with AC). Get it from the Twilio Console. |
TWILIO_AUTH_TOKEN | Twilio Auth Token. |
TWILIO_FROM_NUMBER | Sender phone number in E.164 format (e.g. +14155551234) or WhatsApp format (e.g. whatsapp:+14155551234). |
For WhatsApp, the from number must use the whatsapp: prefix (e.g. whatsapp:+14155551234). WhatsApp messages require either an approved message template or an open 24-hour customer service window.
Send an SMS alert when a webhook fires:
Webhook Trigger → Twilio (send_sms)
Twilio settings:
- Operation:
send_sms - To:
{{ webhook.body.phone }} - Message Body:
Alert: {{ webhook.body.message }}
Access the result downstream:
{{ twilio.success }}
{{ twilio.sid }}
{{ twilio.status }}
Send a WhatsApp confirmation after payment:
Webhook Trigger (Stripe) → Twilio (send_whatsapp)
Twilio settings:
- Operation:
send_whatsapp - To:
{{ webhook.body.data.object.customer_phone }} - Message Body:
Payment of ${{ webhook.body.data.object.amount }} received. Thank you!
Ensure TWILIO_FROM_NUMBER is set to a WhatsApp-enabled sender (e.g. whatsapp:+14155551234).
import webhook from @tensorify/webhook-trigger:4.0.0
import twilio from @tensorify/twilio-sms:1.0.0
node trigger @tensorify/webhook-trigger:4.0.0 {
path = "/notify"
method = "POST"
}
node sms @tensorify/twilio-sms:1.0.0 {
operation = "send_sms"
to = "{{ webhook.body.phone }}"
body = "Alert: {{ webhook.body.message }}"
}
trigger.payload -> sms.input
Twilio has a hidden On Error control output branch (error). Enable it via the "Error output handle" toggle at the bottom of the settings panel.
The error branch fires when the Twilio API returns an error or the request fails at runtime. On the main path, failures are also reflected in {{ twilio.success }} and {{ twilio.error }} on the result output.
- E.164 format: Phone numbers must include the country code with a leading
+(e.g.+14155559876). - WhatsApp restrictions: Outside the 24-hour customer service window, WhatsApp requires approved message templates. Free-form text is only allowed within the window after the recipient messages you.
- From number format: SMS uses a plain E.164 number; WhatsApp requires the
whatsapp:prefix onTWILIO_FROM_NUMBER. - Check
twilio.success: The node completes on the main output even when the send fails. Use an If node or the On Error branch to handle failures. - Agent permissions: Restrict Allowed Operations (Agent) — allow
send_smsonly if the agent should not send WhatsApp messages. - Status vs delivery:
statusreflects Twilio's initial queue status (queued,sent) — delivery confirmation requires Twilio status callbacks, which are not handled by this plugin.
- Webhook Trigger — trigger SMS sends from external events
- Send Email (via Resend) — email notifications as an alternative channel
- AI Agent — connect Twilio as an agent tool
- Environment Variables — store Twilio credentials
