Generating Dynamic SSML from "HTTP Request" to be used on a "Get Input"

88 views Asked by At

I'm wondering if anyone can be of assistance.

I am trying to generate some dynamic Amazon Polly SSML to be used on the Plivo PHLO platform. When someone dials into a particular number, they should be greeted with a custom message (in a particular language) and prompted to enter a number.

I have an HTTP request that hits my API, which receives the request and generates the SSML using Plivo's PHP Server SDK.

$response = new Response();
$speak_elem = $response->addSpeak($result['text'], ['language'=> 'en-US, 'voice'=>"Polly.Joanna"]);

Header('Content-type: text/xml');
die( $response->toXML() );

It seems to me that this HTTP Request is working perfectly and returning perfect SSML. When I copy and hard-code-paste the SSML into the Get Input node, it works OK.

<?xml version="1.0" encoding="utf-8"?>
<Response><Speak language="en-US" voice="Polly.Joanna">Welcome To 101 Broadway. For English, press 1.</Speak></Response>

However, when I try to add a Get Input component and link it's "prompt" audio to the resulting SSML, I am getting an error that says Invalid SSML (See Screenshots at the bottom).

WHAT I'VE TRIED

  • I've tried returning the SSML in plain XML and using {{HTTP_Welcome.response}}
  • I've tried returning the SSML as text in a JSON object called SSML and using {{HTTP_Welcome.response.SSML}}
  • I've tried returning the SSML both with and without the xml tag.
  • I've tried returning the SSML both with and without the Result tag.
  • I've tried taking a break and coming back to it. Hey, you never know.

No matter how I return the SSML, and how I try to link it to the Get Input prompt, I am unsuccessful. I'm starting to wonder if this is even possible?

Any help would be immensely appreciated. Thanks!

SCREENSHOT 1

Validated SSML

SCREENSHOT 2

PHLO Error

1

There are 1 answers

0
Mohammed Huzaif On

My name is Mohammed Huzaif, and I work for Plivo as a Developer Evangelist.

Unfortunately, the "GetInput node" in PHLO does not yet implement the feature you are searching for. The best option is to use a standard speak which is customisable in your way, which may have a less natural feel than SSML.

Currently, I've narrow information about your use case as of now but If you still want to use a custom SSML, I'd recommend utilising a framework instead of PHLO to design your call flow. Here's a tutorial that covers a few use cases by Plivo in several frameworks to help you develop one.

If you experience any problems, please feel free to contact our support team.