google-sheetstwiliozapier

Stuck on how to automate the scheduling of a Twilio Studio Flow, with Google Sheets and Schedule by Zapier


I am trying to automate (once a day) the running of a Twilio flow. The main thing I need Schedule to do is trigger a Twilio flow, sending information from a Google Sheet (Phone Number to send text to, text message text). The way it currently works is:

  1. In Google Sheets I have Sheet1 which includes the columns: “Phone Number” and “Text Message Text”.
  2. In Google Sheets, I also have an AppsScript that (when I click manually) will send the data to trigger a Twilio flow that sends a text to each “Phone Number” in the column their custom “Text Message Text”.
  3. When the user respond to the text, I have custom code triggered in the Twilio flow that stores the output text in the same google sheet in the “Sheet2”

I can’t figure out how to make the scheduling part work in Zapier. I see how to connect Google Sheets + Twilio, and Schedule + Twilio, but I can’t figure out how to use Schedule to trigger sending info from a Google Sheet and kickstarting a Twilio flow. Any thoughts on how I could approach this? Or if there is a different set of tools I should think about using?


Solution

  • You need to get Zapier to trigger an action in Google Sheets that then runs the rest of the workflow.

    Google Apps Script projects can be published as web apps, this gives them a URL that you can make requests to from an external source, like Zapier in this case. To do so, you need to define a doPost(e) function in your script that does some work and returns an HTMLOutput or TextOutput object. In your case, your doPost(e) function can call the function you have already created that sends the data to Twilio and then return an empty response.

    Once you have hooked up the doPost(e) function, you can deploy the script as a Web App by clicking Deploy -> New Deployment and then selecting Web App as the deployment type. Once you've filled in the rest of the required data it will be deployed and you will have a URL. There's more on this process in the Google Apps Script documentation here.

    You can then take that URL and use it as the destination for a scheduled HTTP request in Zapier.