Setting SSML string in a variable

I plan to use a component to do the work of asking a question, handling repetition, graceful exits, and doing some scoring. Obviously the question text should be passed in to the component as a variable. However the string has SSML markup. For example:

We will take three big deep breaths together. Inhale through your nose for 4 seconds. Exhale out your mouth for 4 seconds. Repeat.

When I paste the SSML string into the variable value Voiceflow unhappily spits the string back out in red and won’t take it. I tried adding double quotes around it, but the quotes around strong and the delay times are fouling that up, even if I change each internal double quote to a triple double quote like so:
“<prosody rate= “”“slow””" > We will take three big deep breaths together.<break strength=“”“strong”“” /> Inhale through your nose for 4 seconds. <break time= “”“4s”“” /> Exhale out your mouth for 4 seconds. <break time=“”“4s”“” /> Repeat. <break time= “”“1s”“” />"

Now it says “Unexpected string” in red.

I tried converting it to Jason which escapes the double quote by putting a backslash in front of it like this:

“<prosody rate="slow"> We will take three big deep breaths together.<break strength="strong" /> Inhale through your nose for 4 seconds. <break time="4s" /> Exhale out your mouth for 4 seconds. <break time="4s" /> Repeat. <break time="1s" />”

That at least does not get an error message right away. However when I run it I see “SyntaxError: Unexpected identifier”.

I tried using single quote strings around it. That at least runs, but at run time shows up in red under “Evaluating code - changes” (with debug mode on).

Is there some other way to escape the SSML so I can put it directly in the variable that Voiceflow can later use to speak with the prosody?

Thank you for your time.

I tried putting the SSML string in a field in DynamoDB. When I use the API block to GET it, the returned string is full of “/r/n” carriage return line feeds and even the field name quotes are escaped. For example:


“{\r\n "exercise": [\r\n {\r\n "exercise_num": 1,\r\n "exercise_name": "Lifting arms to the sky",\r\n\t\t\t"exercise_area":"arms",\r\n\t\t\t"exercise_description_full":"<prosody rate="slow"> We’re going to be reaching our arms up for this exercise.<break strength="strong" /> In a standing position, lift your arms up as far as you can <break strength="strong" /> like you’re reaching for the ceiling <break strength="strong" /> and hold for 15 seconds.<break strength="strong" /> We’re elongating the spine. <break strength="strong" /> Take a deep breath, in and out as you reach up. <break strength="x-strong"/><break time="2s"/>",\r\n\t\t\t"exercise_type":"stretch"\r\n } ]\r\n}”

I looked at the transform in my AWS API Gateway that was returning the response, but I didn’t see anything that was adding the escaping on that end.

If there is no SSML in the string, then the response is returned in normal format as I would expect.

“exercise”: [
“exercise_num”: 3,
“exercise_name”: “Bring hands behind the back”,
“exercise_area”: “arms”,
“exercise_description_full”: “Next, we’re going to stretch out our back and chest. Bring your hands together behind your back. Rest them on your lower back and lift up your chest. You should feel a nice stretch in the lumbar spine, and along the chest. Hold for 20 seconds. . . .”,
“exercise_description_repeat”: "If you want a deeper stretch, move your hands up behind your back and hold them in that position. If it becomes painful, continue to rest your hands on your lower back as you stretch. ",
“exercise_repetitions_to_do”: 1,
“exercise_type”: “stretch”

Any ideas on an optimal way to remove or prevent the escaping in the response returned from an API call?

Thank you for your time.

And, as usual I see the answer after I post a question. The answer is to use javascript to replace the escapes with nothing, like:

exercise = exercise.replace(/\r|\n/g)‘’)

Which is all well and good, however I’m just trying out Voiceflow for a hackathon with a couple of teammates. I’m not going to invest USD $120+ to finagle this.