1

https://www.twilio.com/docs/studio/widget-library#run-function

When you invoke a Function, you have two possible options for using variables: (1) you can pass Flow variables as parameters into a Function (e.g. flow.data.foo), and (2) you may set Flow variables with data returned from the Function (TwiML or JSON can be returned).

Does anyone know how to set Flow variables with data returned from a Function?

Fredrik L
  • 1,790
  • 4
  • 21
  • 28

1 Answers1

1

You should be able to follow the Liquid Syntax documented here, to do so.

Liquid Template Language - Assigning Variables

https://www.twilio.com/docs/studio/user-guide/liquid-template-language#variable-assignment

Or just call the returned variable by addressing the Function widget as shown at the link below:

https://www.twilio.com/docs/studio/widget-library#run-function

widgets.MY_FUCTION_WIDGET_NAME.parsed.xxxxx (where xxxxx is the JSON path).

Alan

Alan
  • 10,465
  • 2
  • 8
  • 9
  • Thanks, I doubt the scope of the LTL variables are is flow level though. I'm aware of the parsed widget variables but the point of the Flow variables would be so I don't have to keep passing them as parameters into the other subsequent functions. But it's not a blocker though. – Fredrik L Sep 25 '18 at 01:12
  • Twilio developer evangelist here. The second part of this answer is correct, you need to pass off to a Function (or HTTP request) and respond to it with JSON. The JSON response will then be parsed into the pattern that Alan has shown above. – philnash Oct 29 '18 at 04:05