Search code examples
alexa-skills-kit

Trying to call another intent from a function in Amazon Alexa


I am looking to create a simple coffee ordering skill for the office. I am new to node and amazon alexa. I am using the alexa-app package. I want Alexa to respond to my response with a different question or separate intent depending on my request. What is the best way to do about this? I am having difficulty seeing how to trigger a new intent.

Example conversation flow:

Me: Alexa, start office Assitant

Alexa: How can I help?

Me: I would like order some coffees. (or any other services)

New intent started based on request

Alexa: Great, what would you like?


Solution

  • In the response to "I would like to order some coffees", you can send a response to the Alexa Cloud Service specifying shouldEndSession as false. See the documentation on the response object here. This will make the Echo continue to listen for a second user intent.

    You can have a separate utterance which will map to an intent to order a specific sort of coffee (maybe using the custom slot type syntax):

    SpecificCoffeeIntent I would like a {CoffeeType}, please
    

    Note that you don't call this intent directly - when the user says "I would like a mocha please" in response to Alexa saying "Great, what would you like?", you'll be sent a SpecificCoffeeIntent. Your code can then process the intent to order coffee.