0
votes

I want to build an Alexa skill using NodeJS. This skill will accomplish the tasks of a receptionist, which we want to install in office. It will fetch details about the visitor from the DB on providing the employee ID. Then asks for number of days of visit and user responds by giving number of days. Then it asks about the Host name and the skill sends the mail/msg to the host name provided. The entire skill should have a good flow of questions and the user responses to it.

I have built few basic Alexa skills, but that involved me asking a question and the skill responds after mapping that particular question to an intent. In this skill according to me there is no need of separate intents, but instead alexa asks questions and there should be proper mapping of each question to related response.

My question is how Alexa knows conversational context so that your skill knows what the customer response is referring to. For example, user can answer yes/no to different questions and they will all map to the same Amazon.YesIntent/Amazon.NoIntent.

I know that it involves some concepts of State handling, i referred this link and this link

But a detailed example would help a lot!!

1

1 Answers

3
votes

You need to store your state in your json response. (in session attributes)

Amazon says that:

When returning your response, you can include data you need to persist during the session in the sessionAttributes property. The attributes you provide are then passed back to your skill on the next request.

https://developer.amazon.com/docs/custom-skills/request-and-response-json-reference.html#session-object

If you need an example, this link would be helpfull https://www.raymondcamden.com/2017/09/01/an-example-of-sessions-with-amazon-alexa-skills/