Why does Twilio Studio insert line breaks around variables in my text and json?

31 Views Asked by At

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.

0

There are 0 best solutions below