Setup voice response on twilio number with appscript

62 views
Skip to first unread message

Le pirate noir

unread,
Jul 1, 2022, 1:09:41 PM7/1/22
to Google Apps Script Community
I bought a twilio phone number and i would like to setup a voice response with appscript when someone composed that number (i want twilio to read a text i'll store in a spreadsheet). 

I know how to setup what i need to be say directly on twilio (twiml bin)  but as i want to interact with what the caller selected, the code should be directly in appscript not twilio.

Let's say, when someone compose my twilio # the voice response say :

Hi, u have joined Joe mechanic shop !

To cancel or confirm an appointment, press one.
 To speak to one of our advisors, press two.
  To leave us a message, press three

if one is chosen, i'll ask the user to enter his phone number. After that I need to be able to save the number in a spreadsheet

if 2 is chosen, i want to redirect the call to my cellphone

if 3 is chosen, i want to save in my spreadsheet the vocal message the caller left.

Is there an evangelist of twilio here that can help me out with this ?

Regards !

Care Full Moving Admin

unread,
Sep 18, 2022, 6:34:47 PM9/18/22
to Google Apps Script Community
there is a library for google apps script called twilio-gas on github, copy over all of the .gs files, and add another library called Underscore (used by twilio-gas) by adding the script id found on the Underscore for oole apps script github page (found by googling it)

now call the project with those files and that library "twilio-gas" and deploy it as a library
now get the script id from settings

create a new apps script and click add library and paste the script id from your "twilio-gas" library

now you can use the twilio-gas client as directed on its github readme

the only issue is you can only make use of the rest client to make calls, etc. you cant return twiml because freaking google stopped supporting the XML mimetype for responses as far as i can see, it just defaults to xml in text mime type which twilio doesnt support and i cant get html with xml to work

let me know if you figure anything out. currently i am using twilio functions and then just calling the google apps script as required to do things with sheets, etc. but would be nice to move all code to one place, in google apps script
Reply all
Reply to author
Forward
0 new messages