Chris and I were able to work together to get forwarding & tracking to work with Twilio and Bubble. Here is a summary:
- List Available numbers & purchase a phone number with twilio (API connector)
- Create a webhook in your backend workflows. Then, set the voice_url of the phone number you purchased to the webhook url you created.
- Create a serverless function inside of the twilio dashboard and have it return the twiml (xml) required for forwarding a call. Then, in your webhook, make a request to your twilio function. You’ll need to create a plugin server side action to make this request though because the API connector does not support returning XML without first converting it to JSON (very annoying).
- In your webhook, after making the request to your function, use the “return data” action and return the xml from your request to your twilio function. Watch out, you need to set the content type to
other and then input application/xml.
- Now when someone calls the number, it will make a
POST request to your webhook and the webhook will return the twiml (as raw xml) that will tell twilio to forward the call. The person calling the number will then be forwarded
Congratulations!
2 Likes