0

I have a question, it is possible that it can be called again method that was executed in a handlerIntent? When you come back and finish talking? I need to rerun: const response = await logic.consultaService (1,1,1100);

after finishing the call

Without the user having to say the command again

I require an automatic action until the user says stop

return handlerInput.responseBuilder .speak (speechText) .reprompt ('tss') .getResponse ();

thank you.

Code:

const CustomServiceIntent = {
    canHandle(handlerInput) {
        return handlerInput.requestEnvelope.request.type === 'IntentRequest'
            && handlerInput.requestEnvelope.request.intent.name === 'CustomServiceIntent';
    },

   async handle(handlerInput) {
        try {
            await logic.callDirectiveService(handlerInput,"espera");
          } catch (error) {
            console.log("Progressive error : " + error);
        }

        const response = await logic.consultaServicio(1,1,1100);
        let speechText="";


        if(response) {
            const results = response;

          results.forEach(function (elemento, indice, array) {
            speechText += "  El  " + " " + "  siguiente  " +" "+ " niño  " + " "+ " en   "+" " + " salir   es  " + " " +" . " + elemento.nombre + " . " ;
          });
        }

        return handlerInput.responseBuilder
            .speak(speechText)
            .reprompt('tss')
            .getResponse();
    }
};
Alejandro
  • 1
  • 2

1 Answers1

0

may I suggest you use Dialog Management to solve this?, if the idea is that the user says "stop" or something you can do that with Dialog Management handling the status. Give it a thought I think that might work. Seems to me that what you want to achieve can be realized using that Dialog Management feature.

I hope it helps otherwise lets give it a thought.

  • Thank you very much for answering my question, my problem is that I need alexa through the voice command "query" alexa re-enter information from a webService that returns as a Json that I already have it, and I need that somehow when I finish speaking, automatically check the webService indefinitely by automatically consulting the webService, without a person having to order it, is that possible? – Alejandro Jul 26 '19 at 15:57