Friday 5 May 2017

Alexa Skill response is showing nothing when doing in setTimeout

Stuck from day. Problem is like this.

var alexa = require('alexa-app');

// Define an alexa-app
var myapp = new alexa.app('myapp');

myapp.intent('WelcomeIntent', function(request,response) {
    console.log(request);
    response.say("This  is not working.<break time='2s'/>")
    setTimeout(function(){
            response.say("This  is inside timeout.")
    },1000);
});

On the Speech Simulator Amazon Alexa the output look like this.

{
  "version": "1.0",
  "response": {
    "outputSpeech": {
      "type": "SSML",
      "ssml": "<speak>This is not working.<break time='2s'/></speak>"
    },
    "shouldEndSession": false
  },
  "sessionAttributes": {}
}

Please help me out. Problem is the response inside the asynchronous function like Promise or setTimeout or fetch or google map API I am not getting the proper response.



via kian

No comments:

Post a Comment