简体   繁体   中英

Alexa Responses and Response Builder

I have certain doubts related to Alexa responses .

1. this.emit(':ask', speechOutput, repromptSpeech)

I know that this.emit(':tell',speechOutput) will cause alexa to speak the speechOutput and then close the session, and this.emit(':ask', speechOutput, repromptSpeech) will not close the session, and Alexa will wait for user Input. But where will this new input (given by the user) be stored. For eg:

User : What is the day on 2nd of "blah blah blah" {This was supposed to be a slot input}

Alexa : Sorry I didn't get the date /*speechOutput*/ . Will you repeat it for me? /*repromptSpeech*/

User : It was 2nd of January, 2018.

Now where will this new information 2nd of January, 2018 will be stored. Is there any function where I can pass a parameter which will store the new response of the user?

2. `this.emit(':responseReady')`

If I use this.response.speak(speechOutput) multiple times in my skill without calling the function this.emit(':responseReady') , will it work as expected, or will Alexa just speak the speechOutput which is encountered first?

3. How to make the conversation interactive?

In my skill I'm providing a lot of data to the user which is not good. What I was doing till now is:

  • I. Get the result from web

  • II. Build a single response ( speechOutput ) of all the data (which contains more than 100 lines)

  • III. Speak the speechOutput using this.emit(':tell',speechOutput)

But I want to know is there a way so that I can give 2 or 3 lines of response to user and then ask 'Do you want to know more?'. And based on the answer of the user ie 'Yes' or 'No', I will tell more results or just exit from the skill.

Yes you can provided 2 or 3 line response using SSML and emit ask so that alexa mic are open to take input from the user depending upon what type of question you are putting up you have to handle the intent like "Do you Know more" the probable response from user would be Amazon.Yes/ Amazon.No . Use states to have better intent mapping.

For Case 1: Basically you might have created a slot. For this one -> User: It was 2nd of January, 2018. you can fetch it directly using event.request.intent.slot.date.value

For Case 3: To make conversation interactive use Dialog Interface https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs#dialog-interface . For your example you can use elicit slot directive and confirm slot directive.

Response builder can be used to make multiple speech outputs for example when using below code:

this.response.speak(speechOutput1);
this.response.speak(speechOutput2);
this.emit(':responseready');

expected output: speechOutput1 + speechOutput2

To put this into english, you can and should utilize a response builder when needing to use audio or something other than Alexa talking.

While when trying to make interactive skills you should focus on making the conversation as natural as possible using just responses and making key phrases that trigger other intents be something the user is sort of prompted to say, making your skill intuitive.

My best results have come from making skills that make a skill intuitive to use and pushes the user in a direction on what to say.

Also AMAZON.Yes & AMAZON.No intents are built in and super useful for your custom skills!

I hope this helped

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM