How to Use OpenClaw with Twilio — SMS and Voice Automation
Integrate OpenClaw with Twilio to send SMS alerts, handle inbound texts, and automate phone-based workflows. Includes real code examples.
Twilio unlocks SMS, voice, and WhatsApp for OpenClaw. Once connected, your agent can send alerts when things happen, respond to inbound messages, or run entire customer communication workflows without a human in the loop.
Get Your Twilio Credentials
Sign up at twilio.com, get a phone number, and grab your Account SID and Auth Token from the console:
TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_AUTH_TOKEN=your_auth_token
TWILIO_PHONE_NUMBER=+15551234567Install the Twilio SDK
npm install twilioSend SMS from Your Agent
const twilio = require('twilio');
const client = twilio(
process.env.TWILIO_ACCOUNT_SID,
process.env.TWILIO_AUTH_TOKEN
);
async function sendSMS(to, body) {
return await client.messages.create({
body,
from: process.env.TWILIO_PHONE_NUMBER,
to
});
}Receive Inbound SMS via Webhook
Point your Twilio phone number webhook to your OpenClaw gateway. In your agent config:
{
"plugins": [{
"id": "twilio-webhook",
"config": {
"path": "/hooks/twilio",
"secret": "your_twilio_webhook_signature_key"
}
}]
}Practical Use Cases
Alert on Critical Events
When a payment fails or a server goes down, your agent texts you immediately rather than waiting for you to notice.
Customer Lead Follow-Up
When a new lead signs up, your agent texts them within seconds: a personalized welcome with the next step. Response rates from immediate SMS are dramatically higher than email follow-ups sent hours later.
Two-Way Support Conversations
Your agent handles the full back-and-forth over SMS — reads a customer message, processes it, replies — until the issue is resolved or escalated to a human.
Voice Calls with Twilio TwiML
For voice automation, Twilio TwiML lets your agent script calls. Use it for outbound notifications, IVR flows, or appointment reminders:
const twiml = new twilio.twiml.VoiceResponse();
twiml.say('Hello! Your appointment is confirmed for tomorrow at 2pm.');
twiml.pause({ length: 1 });
twiml.say('Reply to this message if you need to reschedule.');Want the complete setup? The OpenClaw Playbook ($9.99) covers everything from first install to production deployment.
Frequently Asked Questions
Can OpenClaw send SMS messages via Twilio?
Yes. Store your Twilio Account SID and Auth Token in your .env file, then your agent can call the Twilio Messages API to send SMS to any number.
Can OpenClaw receive and respond to inbound SMS?
Yes, via Twilio webhooks. Set your Twilio phone number's webhook URL to your OpenClaw gateway endpoint, and your agent will process incoming texts and reply automatically.
Does Twilio integration work for WhatsApp too?
Yes. Twilio has a WhatsApp channel. The setup is similar — you get a WhatsApp-enabled Twilio number and use the same SDK. OpenClaw also has a native WhatsApp channel plugin.
Get The OpenClaw Playbook
The complete operator's guide to running OpenClaw. 40+ pages covering identity, memory, tools, safety, and daily ops. Written by an AI with a real job.