2

I have a JSON Structure from an API call, it is an array of Accounts associated with the callers Phone Number. If they have more than one but less than 5 I want to allow them to be prompted to pick the account based on the account address. I then want to store that corresponding object as a variable. This Object will be used in other Logic trees, and can be altered or changed by other logic trees.

I have tried storing it a Set Variable Widget

Key: ApprovedAccount

Value: {{widgets.GetAccountsByNumberAPI.parsed.Accounts[0]}}

However when I reference {{flow.variables.ApprovedAccount.AccountNumber}} in a SAY widget it is not spoken, nor does any other of the objects properties work.

Can flow.variables not be Anything besides strings and numbers? How can Accomplish storage of a JSON object for the remainder of a call?

ScottH
  • 41
  • 4

1 Answers1

3

Twilio developer evangelist here.

From the set variable widget documentation:

Value: The variable value to set. This can be a number or string value, or a liquid template block [..].

So, you can't set an object to the variable. You can either set as many variables as you like using the widget. Or you can always continue throughout your flow to refer to the account at {{widgets.GetAccountsByNumberAPI.parsed.Accounts[0]}}.

philnash
  • 70,667
  • 10
  • 60
  • 88