Skip to content

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

  1. Log in to your Twilio Console
  2. On the dashboard, find your Account SID and Auth Token
  3. 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:

  1. In the Twilio Console, go to Phone Numbers > Manage > Buy a number
  2. Search for available numbers in your desired area
  3. Purchase a number with SMS capability
  4. Note the phone number in E.164 format (e.g., +15551234567)

Step 3: Create a Connection in Raikoo

  1. Navigate to your organization in Raikoo
  2. Click Connections in the left navigation
  3. Click Create Connection
  4. Configure the connection:
  5. Name: Give it a descriptive name (e.g., "Customer SMS Line")
  6. Description: Optional description
  7. Platform: Select Twilio SMS
  8. Go to the Credentials tab
  9. Select Use custom credentials (Twilio always requires your own account)
  10. Enter your credentials:
  11. Account SID: Your Twilio Account SID (starts with "AC")
  12. Auth Token: Your Twilio Auth Token
  13. Phone Number: Your Twilio phone number in E.164 format (e.g., +15551234567)
  14. Click Save

Step 4: Create an Integration (Trigger)

  1. Navigate to Integrations in the left navigation
  2. Click Create Trigger
  3. Configure the trigger:
  4. Name: A descriptive name (e.g., "Customer Support SMS")
  5. Description: What this SMS integration does
  6. External Connection: Select the Twilio connection you created
  7. Go to the Execution tab:
  8. Execution Mode: Choose "Chat Agent" for conversational SMS, or "Workflow" for automated processing
  9. Project: Select the project containing your agent or workflow
  10. Chat Agent (if using Chat mode): Select the AI agent to handle messages
  11. Authentication Mode: Choose how to authenticate executions
  12. Click Save

Step 5: Configure Twilio Webhook

After saving your trigger:

  1. In Raikoo, go to the Webhook tab of your trigger
  2. Copy the Webhook URL
  3. Go to your Twilio Console
  4. Navigate to Phone Numbers > Manage > Active numbers
  5. Click on your phone number
  6. Scroll to the Messaging Configuration section
  7. Under "A MESSAGE COMES IN", select Webhook
  8. Paste your Raikoo webhook URL
  9. Ensure the method is set to HTTP POST
  10. Click Save configuration

Testing Your Integration

  1. Send a text message to your Twilio phone number from your mobile device
  2. You should receive a response from your AI agent or workflow
  3. 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

  1. Verify the webhook URL is correctly configured in Twilio
  2. Check that your trigger is set to Active in Raikoo
  3. Ensure your Twilio phone number has SMS capability enabled
  4. Check Twilio's debugger for any delivery errors

Invalid Signature Errors

  1. Verify your Auth Token is correct in the Raikoo connection
  2. Check that the webhook URL matches exactly between Raikoo and Twilio
  3. Ensure there are no extra characters or spaces in the URL

Responses Not Sending

  1. Verify your Twilio account has sufficient balance
  2. Check that the recipient phone number is valid
  3. Review Twilio logs for any outbound message errors

Long Response Delays

  1. Complex AI responses take time to generate
  2. Consider using shorter prompts for faster responses
  3. 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:

  1. Add a Send Message operation to your workflow
  2. Select your Twilio connection
  3. Specify the recipient phone number in E.164 format
  4. Compose your message

This is useful for: - Automated notifications - Follow-up messages after workflow completion - Scheduled reminders

Next Steps