Twilio SMS Integration
Connect Twilio to Raikoo to build SMS-based AI assistants that can receive text messages and respond automatically.
What You Can Build
- Customer support via SMS: Let customers text questions and receive AI-powered responses
- Appointment reminders: Automated SMS notifications with two-way confirmation
- Survey collection: Gather feedback through text message conversations
- Alert systems: Receive and process incoming SMS from IoT devices or monitoring systems
Prerequisites
Before setting up Twilio SMS integration, you will need:
- A Twilio account with a phone number
- Admin access to your Raikoo organization
- Your Twilio Account SID and Auth Token
Setup Steps
Step 1: Get Your Twilio Credentials
- Log in to your Twilio Console
- On the dashboard, find your Account SID and Auth Token
- Note these values - you will need them for Raikoo
Step 2: Get or Purchase a Twilio Phone Number
If you do not already have a Twilio phone number:
- In the Twilio Console, go to Phone Numbers > Manage > Buy a number
- Search for available numbers in your desired area
- Purchase a number with SMS capability
- Note the phone number in E.164 format (e.g., +15551234567)
Step 3: Create a Connection in Raikoo
- Navigate to your organization in Raikoo
- Click Connections in the left navigation
- Click Create Connection
- Configure the connection:
- Name: Give it a descriptive name (e.g., "Customer SMS Line")
- Description: Optional description
- Platform: Select Twilio SMS
- Go to the Credentials tab
- Select Use custom credentials (Twilio always requires your own account)
- Enter your credentials:
- Account SID: Your Twilio Account SID (starts with "AC")
- Auth Token: Your Twilio Auth Token
- Phone Number: Your Twilio phone number in E.164 format (e.g., +15551234567)
- Click Save
Step 4: Create an Integration (Trigger)
- Navigate to Integrations in the left navigation
- Click Create Trigger
- Configure the trigger:
- Name: A descriptive name (e.g., "Customer Support SMS")
- Description: What this SMS integration does
- External Connection: Select the Twilio connection you created
- Go to the Execution tab:
- Execution Mode: Choose "Chat Agent" for conversational SMS, or "Workflow" for automated processing
- Project: Select the project containing your agent or workflow
- Chat Agent (if using Chat mode): Select the AI agent to handle messages
- Authentication Mode: Choose how to authenticate executions
- Click Save
Step 5: Configure Twilio Webhook
After saving your trigger:
- In Raikoo, go to the Webhook tab of your trigger
- Copy the Webhook URL
- Go to your Twilio Console
- Navigate to Phone Numbers > Manage > Active numbers
- Click on your phone number
- Scroll to the Messaging Configuration section
- Under "A MESSAGE COMES IN", select Webhook
- Paste your Raikoo webhook URL
- Ensure the method is set to HTTP POST
- Click Save configuration
Testing Your Integration
- Send a text message to your Twilio phone number from your mobile device
- You should receive a response from your AI agent or workflow
- The response will appear as a text message from the same Twilio number
Message Handling
Character Limits
SMS messages have character limits that Raikoo handles automatically:
| Encoding | Single Message | Concatenated |
|---|---|---|
| Standard (GSM-7) | 160 characters | 153 per segment |
| Unicode (emojis, special chars) | 70 characters | 67 per segment |
Long responses are automatically split into multiple messages if needed.
Formatting
SMS does not support rich formatting, so Raikoo strips markdown and sends plain text:
- Bold, italic, and other formatting is removed
- Links are preserved as plain URLs
- Lists are converted to plain text
Advanced Configuration
MMS (Picture Messages)
Twilio can receive MMS messages with images. The image URLs are included in the message metadata and can be processed by your workflow.
Two-Way Conversations
When using Chat Agent mode, Raikoo maintains conversation context, allowing natural back-and-forth conversations via SMS.
Webhook Verification
Raikoo automatically verifies Twilio webhook signatures using your Auth Token, ensuring only legitimate requests from Twilio are processed.
Troubleshooting
Messages Not Being Received
- Verify the webhook URL is correctly configured in Twilio
- Check that your trigger is set to Active in Raikoo
- Ensure your Twilio phone number has SMS capability enabled
- Check Twilio's debugger for any delivery errors
Invalid Signature Errors
- Verify your Auth Token is correct in the Raikoo connection
- Check that the webhook URL matches exactly between Raikoo and Twilio
- Ensure there are no extra characters or spaces in the URL
Responses Not Sending
- Verify your Twilio account has sufficient balance
- Check that the recipient phone number is valid
- Review Twilio logs for any outbound message errors
Long Response Delays
- Complex AI responses take time to generate
- Consider using shorter prompts for faster responses
- Use workflow mode for time-sensitive automated responses
Best Practices
- Keep responses concise: SMS is best for brief, actionable messages
- Handle opt-outs: Respect STOP and unsubscribe requests
- Test internationally: Verify your setup works for all target regions
- Monitor usage: Keep an eye on your Twilio billing for unexpected spikes
- Use appropriate authentication: For sensitive operations, consider user verification
Sending Outbound SMS
In addition to receiving SMS, you can send outbound messages from workflows using the Send Message operation:
- Add a Send Message operation to your workflow
- Select your Twilio connection
- Specify the recipient phone number in E.164 format
- Compose your message
This is useful for: - Automated notifications - Follow-up messages after workflow completion - Scheduled reminders
Next Steps
- Create a chat agent optimized for SMS conversations
- Build workflows for complex SMS automation
- Set up email triggers for multi-channel communication