Overview
Twilio is a cloud communications platform that enables voice calling, messaging, and video capabilities. Bandwidth Agent Builder’s Twilio integration provides seamless connectivity for your voice agents.Prerequisites
Before setting up Twilio integration, you’ll need:- A Twilio account
- Account SID and Auth Token from your Twilio Console
- At least one Twilio phone number
- Access to your Agent Builder workspace
Configuration
Step 1: Get Twilio Credentials
- Log in to your Twilio Console
- Find your Account SID and Auth Token on the dashboard
- Navigate to Phone Numbers → Manage → Active Numbers
- Copy your phone number(s)
Step 2: Configure in Bandwidth Agent Builder
- Navigate to /phone-numbers and click Add configuration
- Select Twilio as your provider
- Enter your credentials:
- Account SID
- Auth Token
- Click Save Configuration
- Open the configuration you just created and add at least one phone number (with country code in E.164 format, e.g.
+14155550100). The default caller ID is used for outbound calls.
Step 3: Test Your Configuration
- Create a test workflow
- Click “Call” to verify connection
- Check call logs for successful connection
Inbound Calling Setup
Inbound routing is driven by the phone number itself — there is a single webhook URL for the entire org, and Bandwidth Agent Builder resolves which agent to run from the called number’s assigned inbound workflow. When you save an inbound workflow on a phone number, Bandwidth Agent Builder automatically pushes the webhook URL to that number’sVoiceUrl in your Twilio account (provided the credentials are correct and the number belongs to that account).
Step 1: Assign an Inbound Workflow to the Phone Number
- Go to /phone-numbers and open your Twilio configuration
- In the Phone numbers section, edit the number that should receive inbound calls
- Set its Inbound workflow to the agent that should answer
- Save
Step 2: Verify the Webhook URL in Twilio Console
- Go to Phone Numbers → Manage → Active Numbers in Twilio Console
- Click the phone number you assigned an inbound workflow to in Step 1
-
In the Voice Configuration section, confirm:
- Webhook is set to:
https://agents.labs.bandwidth.com/api/v1/telephony/inbound/run - HTTP Method is
POST
Bandwidth Agent Builder pushed this URL automatically when you saved the inbound workflow in Step 1. If the field is empty, shows a different URL, or Bandwidth Agent Builder surfaced a sync warning, the auto-push failed — most often because the credentials are incorrect or the number isn’t owned by this Twilio account. Paste the URL into the field yourself, set the method toPOST, and click Save Configuration. - Webhook is set to:
Step 3: Verify Setup
- Confirm the provider uses the inbound URL for your workspace
- Check the provider console for callback errors
Test Inbound Calling
- Call your configured Twilio phone number from another phone
- Verify your Bandwidth Agent Builder voice agent answers and responds
- Check call logs in both Bandwidth Agent Builder dashboard and Twilio Console
Troubleshooting
Invalid phone number error
Invalid phone number error
Ensure phone numbers include country code in E.164 format:
+14155550100Authentication failed
Authentication failed
- Verify Account SID and Auth Token are correct - Check for extra spaces in credentials - Ensure credentials haven’t been regenerated in Twilio Console
Webhook signature validation failing
Webhook signature validation failing
- Confirm your Auth Token matches exactly - Verify the webhook URL matches what Twilio sends - Compare the saved webhook URL in both consoles
No audio on calls
No audio on calls
- Verify WebSocket connection is established - Check firewall rules for WebSocket traffic - Ensure audio pipeline is configured correctly
Inbound calls go to voicemail
Inbound calls go to voicemail
- Verify the Twilio number’s webhook is set to
https://agents.labs.bandwidth.com/api/v1/telephony/inbound/run- Ensure the webhook URL is publicly accessible from the internet - Confirm the called number exists in your Bandwidth Agent Builder telephony configuration and has an Inbound workflow assigned - Check the provider’s callback response
Voice agent doesn't respond to inbound calls
Voice agent doesn't respond to inbound calls
- Confirm the phone number has an Inbound workflow assigned in /phone-numbers - Check webhook signature validation is working (Auth Token in Bandwidth Agent Builder matches Twilio Console) - Verify WebSocket connection establishes successfully - Review call logs for error messages
Best Practices
- Test your configuration with a single call before running campaigns
- Monitor Twilio Console for usage and billing