I am building on the Twilio Rest Api v2 and Twilio Studio. For the purposes of my prototype/ demo, I have set up quick loop that is triggered by my Rest call. It asks the user for input 3 times, each time incrementing an parameter which I can print back to the user or send in an http body by typing: {{flow.variables.Attempts}}. What I see in the text I get from twilio is added line breaks.
For example, this code in a Send Message Widget:
Attempt {{flow.variables.Attempts}} of 2.
Which appears this way if I export the Flow's json:
"body": "Attempt {{flow.variables.Attempts}} of 2."
Produces this text on a phone (assume Attempts = 2):
Attempt
2
of 2.
Sending this variable out as form data from my Http Request Widget produces this, where you can see the new line chars:
[{"Key":"Attempts ","Value":["\n 2\n"]}]
Not only does this lead to unpredictable text formats, but it is causing my json to be invalid when I try to post a summary to an endpoint. I do not see this issue addressed in the docs, and their plethora of video demos doesn't seem to have the same problem (although they seem to be on an older version).
Please grant us some wisdom, Twilo-folks. Thank you.
The additional line breaks you encountered might have been caused by an accidental addition of line breaks when you defined the Attempts
variable. It is crucial to be aware of extra whitespaces or breaks when defining a variable in your editor, particularly if the editing space is limited.
To resolve this issue, please ensure to check the string formatting when setting up the variable and avoid any unnecessary whitespaces or line breaks where the number of Attempts
is defined.