You need to sign in to do that
Don't have an account?
Cameron Houser
Formula to create Twilio XML URL - Not really a question, more of a cool solution not out there
How to build an XML file fior Twilio through a URL in a formula field:
Use Case:
You need to build a dynamic text-to-voice concatinated with different audio urls (audion hosted on a website). To accomplish this you need to dynamically build a XML url in a formlua field with audio or voice to text.
What this formula does:
Message%5B1%5D = Message[1]
Message[0] The URL of a media file to <Play>, or a string to <Say>
Check out the Twimlets from Twilio here --> https://www.twilio.com/labs/twimlets
Use Case:
You need to build a dynamic text-to-voice concatinated with different audio urls (audion hosted on a website). To accomplish this you need to dynamically build a XML url in a formlua field with audio or voice to text.
- What I did was anaylize how Twilio was doing with thier Twimlets https://www.twilio.com/labs/twimlets
- Create field for voice-to-text message (will represent Say)
- Create field for audio url (will represent Play)
- No blank spaces alowed in the url
- Use %20 to represent a blank space
- audio urls always are treated as "Play"
- Message%5B0%5D=[text or url here] is template for seperating the text and audio urls (more on this later)
- text is always treated as "Say"
- %3A = :
- %2F = /
'http://twimlets.com/message?Message%5B0%5D='&SUBSTITUTE(Subject, " ", ",%20")&'.%20'&Contact.LastName&'.&Message%5B1%5D='&SUBSTITUTE(SUBSTITUTE(Url__c,':', '%3A'),'/', '%2F')&'&Message%5B2%5D=%20'&Id&'&'Formula result:
http://twimlets.com/message?Message%5B0%5D=Thanks,%20for,%20checking,%20this,%20out.%20Houser.&Message%5B1%5D=https%3A%2F%2Fpink-dog-6501.twil.io%2Fassets%2FSampleAudio_0.4mb.mp3&Message%5B2%5D=%205001I000004ffiT&XML created:
<Response> <Say>Thanks, for, checking, this, out. Houser.</Say> <Play> https://pink-dog-6501.twil.io/assets/SampleAudio_0.4mb.mp3 </Play> <Say>5001I000004ffiT</Say> </Response>
What this formula does:
- 'http://twimlets.com/message?Message%5B0%5D='&SUBSTITUTE(Subject, " ", ",%20")&
- twimlets.com check it out
- Message%5B0%5D=
- Notice the '0', this indicates first position
- '&SUBSTITUTE(Subject, " ", ",%20")&
- Replaces blank spaces with an URL acceptable term = %20
- '.&Message%5B1%5D='&SUBSTITUTE(SUBSTITUTE(Audio_URL__c,':', '%3A'),'/', '%2F')&
- (.) pauses
- SUBSTITUTE(SUBSTITUTE(Audio_URL__c,':', '%3A'),'/', '%2F')
- the audio url
- This replaces ";" and "/" with the acceptable url terms
- '&Message%5B2%5D=%20'&Id&'&'
- I ended the call with another text field called Id
Message%5B1%5D = Message[1]
Message[0] The URL of a media file to <Play>, or a string to <Say>
Check out the Twimlets from Twilio here --> https://www.twilio.com/labs/twimlets