Reputation: 467
Using Twilio Studio, my HTTP widget obtains the following JSON from (external) endpoint:
{
"response": {
"say": "1 address found",
"data": [
"10707 Ewing Drive Kansas City Kansas"
]
}
}
However, I am able to access {{widgets.http_address_schedule.body}}
but not {{widgets.http_address_schedule.parsed.say}}
. Twilio documentation indicates this is possible if my response is JSON.
From documentation at: https://www.twilio.com/docs/studio/user-guide#rest-api
Json: If your function returns valid Json, you should be able to access it via widgets.MY_WIDGET_NAME.parsed
For example, if you return {"message": "Hi", "person": {"name": "Bob", "age": 40}}, you can reference that in subsequent widgets as:
widgets.MY_WIDGET_NAME.parsed.message
widgets.MY_WIDGET_NAME.parsed.person.name
widgets.MY_WIDGET_NAME.parsed.person.age
What is the expected way to send data to be parsed by Twilio?
Upvotes: 1
Views: 747
Reputation: 467
After reviewing Twilio Studio logs, I was able to identify PHP error output embedded in the JSON response. Once the error was resolved Twilio was able to successfully parse response and provide data in parsed
key in {{widgets.http_address_schedule.parsed.response.say}}
Upvotes: 2