0

I am working on a project that includes using Podio, Zapier and Twilio. I am allowing a user to send a text message to a Twilio number, then based on the senders phone number, I am looking up their information in Podio using a Zapier webhook. That part is working fine, but I don't know how to then send data back to Twilio that can be used in the Studio flow. I have created numerous connections with Zapier and done some work with functions in Twilio but I suspect I will need to create some code for this and am not sure exactly what to do next. I have created a Zap in the past to send data to start a studio flow and I have my Zap set to do a post with the data, but not sure where to post it to.

Jeff
  • 3
  • 1

1 Answers1

2

Docs: https://www.twilio.com/docs/studio/rest-api

Each Twilio Studio Flow exposes a "REST API URL". You can trigger the flow with an authenticated (your Twilio SID and Token) POST request to this "REST API URL".

The "REST API URL" shows when you select the "Trigger" widget and it looks something like:

https://studio.twilio.com/v1/Flows/FW123ab456789c1d2e95f345a78b91c2d3/Executions

enter image description here


There are 2 required parameters (phone numbers) to be passed with the request, "To" and "From". The numbers must be formatted as E.164 (e.g. +1xxxxxxxxxx).

You can also pass "Optional Parameters" with a 3-rd POST parameter named "Parameters" with a value in the form of JSON data. For example if you pass in {"name":"Zeke"} then inside a widget you can reference the variable {{flow.data.name}} which will return the string "Zeke". (this is taken from the docs above).

Also, in JSON Data you can pass multiple name/value pairs.

Alex Baban
  • 11,312
  • 4
  • 30
  • 44
  • Alex, I am doing that to start a flow, but I need to lookup information about the person in mid flow and use that during the flow, I think using that URL will place the person at the beginning of the flow again. – Jeff Dec 28 '19 at 16:55
  • What happens when the user sends a message to Twilio and after that? I'm not clear, rather confused, about the steps and which platform is involved with each step. Maybe you could use two flows, one in the receiving message part, going to Zapier, then another flow after you get data from Zapier, if that's how the process unfolds. – Alex Baban Dec 28 '19 at 17:03
  • Sorry for the confusion, The user sends a text message, I am then creating a post to Zapier with the users phone number, zapier looks up the users information in Podio (database) and then needs to send back information about the user, name, id, status. My issue is getting that data into variables to use later in the twilio studio flow. I could use multiple flows, but my desire was to use one. I have another similar project for users to check in and out, but will need to do the same type of lookup and then use the data in the flow. – Jeff Dec 28 '19 at 17:31
  • I'm using the make http request in studio - https://hooks.zapier.com/hooks/catch/85xxx/otxxxp/ this part is working and I am able to receive the information over at zapier, then once I find the user, I assume I need to then post the data back to twilio studio. I think this would work using a function, but I don't have much experience creating functions. – Jeff Dec 28 '19 at 17:40
  • Are you able to respond to the http request with data from Zapier? https://www.twilio.com/docs/studio/widget-library/http-request Also, if you post to the `REST API` trigger, will not place the user back to the initial `Incoming Message` trigger. – Alex Baban Dec 28 '19 at 17:48
  • Studio will parse JSON returned by the HTTP request widget. You can then access the parsed JSON as variables using liquid syntax (curly braces). Look at the Studio log of a current Studio execution, you will see the data returned in the HTTP Request widget if you drill down (should appear under parsed). Then access via the displayed JSON path. – Alan Dec 28 '19 at 20:12