Twilio Integration
Overview
The Twilio integration in Lamatic provides communication automation capabilities through SMS, voice calls, and WhatsApp messaging. This integration enables automated multi-channel communication within workflows, supporting comprehensive communication automation across different channels including SMS, voice calls, and WhatsApp messaging.
The Twilio integration provides Action capabilities for sending messages and making calls. You can integrate it into your flows to automate communication processes.
Features
✅ Key Functionalities
- Action - Send SMS: Sends text messages to phone numbers with customizable content and delivery options.
- Action - Send Voice Call: Makes automated voice calls with custom messages and call management features.
- Action - Send WhatsApp Message: Sends WhatsApp messages including text and media content to WhatsApp-enabled numbers.
✅ Benefits
- Multi-Channel Communication: Supports SMS, voice calls, and WhatsApp messaging from a single integration.
- Automated Messaging: Streamlines communication processes with programmable messaging and calling.
- Global Reach: Leverages Twilio’s global infrastructure for reliable message delivery worldwide.
- Rich Media Support: Enables sending media files through WhatsApp messaging for enhanced communication.
Prerequisites
Before setting up the Twilio integration, ensure you have the following:
Always required:
- Twilio Account: A valid Twilio account with proper authentication setup.
- Twilio Credentials: Account SID and Auth Token from your Twilio console.
Required for the actions you plan to use:
- SMS: A purchased Twilio phone number with SMS capability enabled.
- Voice Calls: A purchased Twilio phone number with voice capability enabled.
- WhatsApp Messages: Either the Twilio WhatsApp Sandbox (development and testing) or a registered WhatsApp sender (production). See below.
WhatsApp: Sandbox vs. Production
WhatsApp messages cannot be sent from a standard Twilio phone number. You have two options:
Twilio WhatsApp Sandbox (development and testing)
The Sandbox lets you send and receive WhatsApp messages immediately. No WhatsApp Business Account and no Meta approval are required, which makes it the fastest way to test a flow.
- Find your sandbox number and unique join code in the Twilio Console under Messaging → Try it out → Send a WhatsApp message.
- Each recipient must opt in by sending
join <your-join-code>to the sandbox number, or by scanning the QR code shown in the Console. - Use the sandbox number as your From (WhatsApp) value in the node.
Sandbox limitations:
- You can only message users who have joined your sandbox.
- Sessions expire three days after joining. Recipients must rejoin after that.
- Rate limited to one message every three seconds.
- Business-initiated messages can only use Twilio’s pre-approved templates (Appointment Reminders, Order Notifications, Verification Codes).
- The sandbox number is shared across Twilio accounts and cannot be customized.
Registered WhatsApp sender (production)
For production traffic, custom message templates, or your own branded number, register a WhatsApp sender through Twilio’s WhatsApp Self Sign-up (direct customers) or the WhatsApp Tech Provider Program (ISVs). This is the path that involves WhatsApp Business Account setup and approval.
Setup
Step 1: Set Up Twilio Account
-
Create Twilio Account:
- Sign up for a Twilio account at twilio.com
- Verify your phone number and complete account setup
-
Get Credentials:
- Navigate to your Twilio Console Dashboard
- Copy your Account SID and Auth Token
- Store these credentials securely for use in Lamatic
-
Set Up Your Sending Channels:
- For SMS or voice calls: Purchase a Twilio phone number with the capability you need (SMS, voice, or both).
- For WhatsApp: Use the WhatsApp Sandbox to get started without approval, or register a WhatsApp sender for production. A regular phone number will not work for WhatsApp. See WhatsApp: Sandbox vs. Production.
Step 2: Set Up Lamatic Flow
-
Create a Custom Flow for Twilio automation:
- Configure the Twilio node based on your use case
- Set up action parameters for your communication needs
- Test the integration with your Twilio credentials
-
Use Pre-built Templates: Start with our
Twilio Communication Template
Step 3: Configure Node in Lamatic
- Add the Twilio node to your flow.
- Provide necessary credentials and communication parameters.
- Configure the specific action (SMS, Voice Call, or WhatsApp Message).
Step 4: Testing
For testing, you need to manually provide phone numbers and message content as dummy data. Once deployed, these values will be automatically processed through your configured Twilio integration.
Configuration Reference
Credential Configuration
| Parameter | Description | Required | Example |
|---|---|---|---|
| Credential Name | Display name for the Twilio credentials | ✅ | my-twilio-credentials |
| Account SID | Your Twilio Account SID from the console | ✅ | ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| Auth Token | Your Twilio Auth Token from the console | ✅ | your-auth-token-here |
Action Configuration
Send SMS Action
| Parameter | Description | Required | Example |
|---|---|---|---|
| Name | Display name for the action | ✅ | Send SMS |
| Credentials | Twilio authentication details | ✅ | my-twilio-credentials |
| Action | Type of Twilio action to perform | ✅ | Send SMS, Send Voice Call, Send WhatsApp Message |
| Body | SMS message content | ✅ | Hello, this is an automated SMS message. |
| To | Recipient phone number (E.164 format) | ✅ | +1234567890 |
| From | Sender phone number (your Twilio number) | ✅ | +1987654321 |
| Timeout | Timeout in seconds. Defaults to 60. | ❌ | 60 |
Send Voice Call Action
| Parameter | Description | Required | Example |
|---|---|---|---|
| Name | Display name for the action | ✅ | Send Voice Call |
| Credentials | Twilio authentication details | ✅ | my-twilio-credentials |
| Action | Type of Twilio action to perform | ✅ | Send Voice Call |
| Voice Message | Text to be converted to speech for the call | ✅ | Hello, this is an automated voice call. |
| Call To | Recipient phone number (E.164 format) | ✅ | +1234567890 |
| Call From | Sender phone number (your Twilio number) | ✅ | +1987654321 |
| Timeout | Timeout in seconds. Defaults to 60. | ❌ | 60 |
Send WhatsApp Message Action
Requires either the Twilio WhatsApp Sandbox (development) or a registered WhatsApp sender (production). A standard Twilio phone number will not work. See WhatsApp: Sandbox vs. Production.
| Parameter | Description | Required | Example |
|---|---|---|---|
| Name | Display name for the action | ✅ | Send WhatsApp Message |
| Credentials | Twilio authentication details | ✅ | my-twilio-credentials |
| Action | Type of Twilio action to perform | ✅ | Send WhatsApp Message |
| WhatsApp Message | WhatsApp message content | ✅ | Hello, this is an automated WhatsApp message. |
| To (WhatsApp) | Recipient WhatsApp number (E.164 format) | ✅ | +1234567890 |
| From (WhatsApp) | Sender WhatsApp number. Your Sandbox number or registered WhatsApp sender. | ✅ | +14155238886 |
| Media URL | URL of media file to send (image, document, etc.) | ❌ | https://example.com/image.jpg |
| Timeout | Timeout in seconds. Defaults to 60. | ❌ | 60 |
Low-Code Example
Send SMS Action
nodes:
- nodeId: twilioNode_1
nodeType: twilioNode
nodeName: Twilio
values:
credentials: my-twilio-credentials
action: sms
timeout: 60
to: '{{triggerNode_1.output.sampleInput}}'
from: '{{triggerNode_1.output.sampleInput}}'
body: Test SMS
modes: {}
needs:
- triggerNode_1Send Voice Call Action
nodes:
- nodeId: twilioNode_2
nodeType: twilioNode
nodeName: Twilio
values:
credentials: my-twilio-credentials
action: voice_call
timeout: 60
to: '{{triggerNode_1.output.sampleInput}}'
from: '{{triggerNode_1.output.sampleInput}}'
body: Test Voice Call
modes: {}
needs:
- triggerNode_1Send WhatsApp Message Action
nodes:
- nodeId: twilioNode_3
nodeType: twilioNode
nodeName: Twilio
values:
credentials: my-twilio-credentials
action: whatsapp
timeout: 60
whatsappTo: '+911234567890'
whatsappFrom: '+14155238886'
whatsappMessage: Test WhatsApp Message
modes: {}
needs:
- triggerNode_1whatsappFrom in this example is Twilio’s shared Sandbox number. For production, use your registered WhatsApp sender number instead.
Output
The Twilio node returns the same output shape for all three actions:
sid: String identifier assigned by Twilio for the message or call (Twilio’s SID).status: String indicating the delivery or call status.message: String containing a status or error message.output: Object containing the response payload from Twilio.
Example Output Reference
schema:
output: object
sid: string
message: string
status: stringTroubleshooting
Common Issues
| Problem | Solution |
|---|---|
| Authentication Errors | Verify that the Account SID and Auth Token are correct and valid |
| Invalid Phone Numbers | Ensure phone numbers are in E.164 format (e.g., +1234567890) |
| SMS Delivery Fails | Check if the recipient number is valid and can receive SMS |
| Voice Call Issues | Verify the sender number has voice calling capabilities enabled |
| WhatsApp API Errors | If using the Sandbox, confirm the recipient has joined it and the session hasn’t expired. If using a registered sender, ensure it is properly configured and approved |
| WhatsApp message not delivered (Sandbox) | The recipient must send join <your-join-code> to the sandbox number first. Sandbox sessions also expire after three days, requiring the recipient to rejoin |
| Rate Limiting | Implement appropriate delays between API calls to avoid hitting rate limits |
| Insufficient Credits | Check your Twilio account balance and add funds if necessary |
Debugging
- Check Twilio API logs for detailed error messages
- Verify phone number formats and validity
- Test credentials using Twilio’s API explorer
- Monitor account usage and billing
- Validate media URLs for WhatsApp messages
- Check network connectivity and firewall settings
- Review Twilio API documentation for specific error codes
- Ensure proper permissions for the phone numbers being used