Twilio gives you phone numbers that send and receive SMS, and access to WhatsApp. With HostWebhook you can send an SMS or a WhatsApp message from a flow, read your messages, look up a number, start a flow when someone texts your Twilio number, and let an AI node reply for you.
Every message costs money in your Twilio account. Twilio charges each SMS part and each WhatsApp message, including the ones your number receives and the ones that fail to send. HostWebhook adds nothing. For your first tests, send to your own phone.
Connect your Twilio account
HostWebhook connects with a restricted API key that you create in Twilio. Your Auth Token is never asked for.
In the Twilio Console, open API keys & tokens (in your account settings) and click Create API key:
- Give the key a name only HostWebhook uses, like
HostWebhook. - Keep the region United States (US1).
- Set the key type to Restricted.
- Tick the permissions in the table below, and nothing else.
- Click Create.
Twilio shows the secret only once.
Right after Create, Twilio shows the key's SID (it starts with SK) and its secret. If you don't see the secret, scroll up: it is in the Secret box, with a Copy the secret button. Keep that page open, and don't click Done until you have pasted both values in HostWebhook. If you lose the secret, delete that key and create a new one.
Then, in HostWebhook, click Settings in the left sidebar, then Credentials, and start a new credential. Choose Twilio.
- Marker 1: In the list of types, choose Twilio.
- Marker 2: Give the credential a name, like My Twilio account.
- Marker 3: Paste your Account SID (it starts with
AC; it's on your Twilio Console home page), the key's API key SID (SK…) and its API key secret. - Marker 4: Click Connect Twilio. HostWebhook checks the key against your account and counts your numbers.
- Marker 5: Which permissions? and What does it cost? open the lists below.
- Marker 1: Which permissions? lists what to tick in Twilio.
- Marker 2: HostWebhook never asks to delete messages, buy numbers or change your account.
- Marker 3: Each permission, what it is for, and what stops working without it.
- Marker 4: What does it cost?: what Twilio charges.
| Twilio product | Resource and actions | What for |
|---|---|---|
| Messaging | messages: create, list, read | Sending SMS, MMS and WhatsApp messages, reading them, and the trigger's Test push |
| Messaging | messages.media: list, read | The files of a message |
| Messaging | services: list | The Messaging Service picker |
| Messaging | whatsapp-senders: list | The WhatsApp sender picker |
| Messaging | content-templates: list, read | The template picker and its variables |
| Phone-numbers | active-numbers: list, read | Checking the key when you connect, the From picker and the trigger's number. Without it, the credential won't connect. |
| Event-streams | sink: create, read, list, delete · sink.test: create | The trigger |
| Event-streams | subscription: create, read, list, update, delete · subscription.subscribed-event: list | The trigger and its daily health check |
| Lookup | phone-numbers: read | Look up a number (the basic lookup, free) |
That's 23 permissions. If you only send messages, you can leave out the Event Streams ones: the trigger won't work without them.
US1 accounts only, for now.
HostWebhook works with accounts in Twilio's United States region (US1), where most accounts are. If Twilio rejects the key when you connect, check that you pasted the right Account SID, and that the key still exists in API keys & tokens: a key deleted in Twilio is rejected too.
Add a Twilio node
In Flows, add a Twilio node and open it. Pick your credential under Twilio account.
- Marker 1: The Twilio account the node sends from: the end of its Account SID and how many phone numbers it has.
- Marker 2: Single operation: the node does one thing every time it runs, with values taken from the event that reaches it. For example: a text to the customer who just paid, a WhatsApp message to your team when a form arrives.
- Marker 3: AI toolkit: an AI node decides which tool to use (see step 07). Because every message costs money, it comes with two limits.
- Marker 4: The operation, here Send SMS (step 03). The ones that send are marked, and each message costs money in your Twilio account.
Choose what it does
Under Operation, open the list and pick one of the eight operations. They come in four groups. Only the two in Send cost money; none of them deletes anything.
- Marker 1: The operation you picked, here Send SMS.
- Marker 2: Type to search the list.
- Marker 3: The operations, with what each one does. The group name is above each block.
| Group | Operations |
|---|---|
| Send | Send SMS, Send WhatsApp |
| Messages | List messages, Get message |
| Structure | List phone numbers, List Messaging Services, List templates |
| Numbers | Look up a number |
Every field takes a template such as {{payload.from}}, so you can fill it in from the event that started the flow.
Pick the number it sends from
From is picked from your account, so you don't need to type your number.
- Marker 1: From: the number the message leaves from, with what it can do (SMS, MMS, voice).
- Marker 2: Refresh reloads the list after you change something in Twilio.
- Marker 3: Your numbers. With Send WhatsApp, the list shows your WhatsApp senders, and the Sandbox if you use it.
You can also write a number in the international format, like +14155550100, or a template.
Send an SMS or a WhatsApp message
With Send SMS, pick From, write who it goes to in To, and the text in Message.
- Marker 1: From: your Twilio number.
- Marker 2: To: the phone number with its country code, like
+14155550100. Here it's a template,{{payload.from}}(shown as a From chip), so the reply goes to whoever texted. - Marker 3: Message: the text. Under it, how many SMS parts it takes: a long text is sent, and charged, as several parts.
- Marker 4: Media (optional): the link to an image or a file, sent as an MMS. Not every country receives MMS.
- Marker 5: Daily limit: the most SMS parts this node sends in a day, so a loop can't run up costs. From 1 to 10,000, for example 200.
- Marker 6: Open Before you text people before your first real messages.
Click Run to try it. The message is sent for real, Twilio charges it, and the node shows what Twilio returned: its sid and its status, such as queued.
With Send WhatsApp, the fields are almost the same.
- Marker 1: From: your WhatsApp sender, here the Twilio Sandbox.
- Marker 2: To: the person's WhatsApp number, here whoever wrote.
- Marker 3: Send as: Reply works within 24 hours of the person's last message to you. After that, WhatsApp only lets you send an approved template.
- Marker 4: Message: the text of a reply.
- Marker 5: Template and Variables: for a template, picked from your Content Template Builder, with a value for each variable.
- Marker 6: Messaging Service (optional): send through one of your Messaging Services instead of a single number.
When someone texts STOP, Twilio stops your messages to them.
After a STOP, Twilio refuses to send to that person, and the node says: This person texted STOP. Twilio won't send until they text START. Twilio still records the failed message, and may charge a fraction of a cent for it.
WhatsApp numbers from Mexico
WhatsApp often keeps a Mexican mobile as +521 followed by the 10 digits, while an SMS uses +52 and the 10 digits. With the WhatsApp Sandbox, send to the number exactly as Twilio saved it when the person joined: a message to +52 without the 1 fails with error 63015 (not joined), and Twilio still charges it.
When the daily limit is reached
The node stops sending until the next day and says so: This node sent its daily limit (200). Raise it in the node. It doesn't call Twilio, so nothing is charged.
Start a flow when someone texts your number
Twilio can also start a flow. Add a Trigger node, choose Twilio as its service, and pick your credential.
- Marker 1: The credential. Its key needs the Event Streams permissions (step 01). The trigger watches numbers that account owns.
- Marker 2: Number: the Twilio number to watch. A trigger watches one number. Your number's own webhook isn't changed, so whatever you already have there, like a voice assistant, keeps working.
- Marker 3: Channel (optional): SMS or WhatsApp. Empty means both.
- Marker 4: Event Trigger: Message received, when a text reaches your number. A STOP fires it too, with
optOutset, so your flow can note it. - Marker 5: The health check runs once a day. Test push tries the trigger before you activate it.
- Marker 6: The watch: Watch is live once the trigger is active, with the last message it received.
Click Test push to see what the trigger will deliver. It reads the latest messages your number received and shows them as a "Message received" notice will arrive. Your flow doesn't run.
- Marker 1: Test push reads the latest messages received.
- Marker 2: The summary: how many it found, and that nothing was dispatched.
- Marker 3: Click one to set it as the node's output, with the exact shape the trigger delivers:
from,to,body,channel,numMedia… Copy its{{payload.x}}paths to build the next node. - Marker 4: Another message, here a
START.
When everything is set, click Activate. A trigger needs at least one connected node to activate. HostWebhook then sets up one Event Streams sink for your Twilio account, shared by all its triggers, and removes it when the last trigger is deactivated or deleted.
If the key stops working, the trigger pauses.
Once a day, HostWebhook checks that Twilio still accepts the key. If you deleted it in Twilio, the trigger pauses (Twilio no longer accepts its key) and the credential shows Needs reconnect. Give the credential a new key of the same account in Edit keys and settings, then activate the trigger again.
WhatsApp and the Sandbox
The trigger only watches numbers your account owns. The WhatsApp Sandbox number belongs to Twilio, so it can't be watched: to start flows from WhatsApp, use a WhatsApp sender of your own. Sending through the Sandbox works (step 05).
Let an AI node text people (optional)
In step 02, choose AI toolkit instead of Single operation. The node then offers its eight tools, such as send_twilio_sms and list_twilio_messages, that an AI node calls by name when you connect it from the AI node's Tools. You can also expose the same node through one of your MCP servers.
- Marker 1: The node is exposed as 8 Twilio tools. The messages the model reads are written by whoever texts your number: HostWebhook tells it to treat them as data, not as instructions.
- Marker 2: Send from: fixed here. The AI picks who to text and what to say, never the number it sends from.
- Marker 3: Limits: the Daily limit of the node, and Messages per run, the most SMS parts the AI may send in one run (from 1 to 20, for example 3).
- Marker 4: Who the AI can text: here, only the person who wrote, the one whose message started the run.
- Marker 5: Open this to see the operations that will be exposed.
- Marker 6: Block these tool calls: a blocked tool is removed from every AI node and MCP server that uses this node. For example, block
send_twilio_whatsappif the agent should only send SMS.
When the AI asks for something a limit doesn't allow, the tool refuses without calling Twilio, and the run shows why.
- Marker 1: The run: its steps and how long it took.
- Marker 2: The Twilio tool, with the calls that were refused.
- Marker 3: A second message in the same run: refused, because Messages per run was 1.
- Marker 4: A message to another number: refused, because the AI can only text the person who wrote.
With MCP, pick a list of numbers.
An MCP call has no message that started it, so only the person who wrote allows nobody. To use the node through MCP, choose Only these in Who the AI can text and add the numbers, like +14155550100. In MCP, the sending tools are marked as destructive; the others only read.
Disconnect Twilio (optional)
To stop HostWebhook from using your account, delete the credential: in Settings, Credentials, open the Twilio credential and click Delete. HostWebhook lists the nodes and triggers that use it: they keep their configuration but stop running until you pick another credential. Click Disconnect and delete.
- Marker 1: The nodes and triggers that still use the credential.
- Marker 2: Where to revoke the key too: in Twilio, under API keys.
- Marker 3: Disconnect and delete removes the credential.
HostWebhook first stops every trigger that used the credential and removes its Event Streams sink, then deletes the credential. A restricted key can't delete itself, so delete it yourself in Twilio: in API keys & tokens, open the key and click Delete this API key.