Hello guys, welcome to the 25th session of create custom Alexa skill using AWS lambda function tutorials for beginners. In this session we will learn how to use dedicated writing to create multi 10 conversation in Alexa, there are two different ways. First is using delicate directive, and another is using a slot contract slot and confirm intent directly. We can also combine both of them. Using this we can check that user provided all values or not. We need to use delicate directive if you want Alexa to automatically handle the conversation flow based on your title of modal.
Dialogue state contains state of the dialogue. When a user sends a request it style can be in three different states that is started in progress and completely. For this I'm going to create a new open terminal I'm using third demo as a knee valgus upgrade launch request text. So we can uniquely identify this key. Open interaction model. Change invocation name to the code demo.
Add new intent. Good name intro with age. This intent we will obtain user's name and age, even optional, so it contains two slots. First will be person name of type, Amazon dot person and second slot will be age of type amazon dot number The user can see myself personally. on myself person name and my age his age. Create a handler for introverts age isn't the same for something.
It will listen for same intent. That is often request from request envelope. intent from request. Here I have used object destructuring assignment. This line is similar to this one. When dialog tech is in this static state, we will check that if the user does not provide age value in slot then we will add 24 as default value in intent itself and generate response with end dialogue directive method and pass updated intent and we need to set false to short and a session Generate response.
If dialogue state is in progress state then we need to return empty delegate directly. And when it is in the completed state, we will display both findings. That is opt in both from slots click speech text gentlemen response is high lead in request handlers and also add log so if any error occurred then we can check it. You can find and deploy this. Let us test it in Ico. Alexa, open ether dem Welcome to third demo skill.
Myself, Elizabeth. Elizabeth, your age is 24 you gotta be have not set age To credit for is used as default. Let us try it again with valuing age. Alexa, open the third demo Welcome to third demo skill myself Elisa and my age is 30. Here listen Elizabeth you're ages 30 here we got the value that we have set. Let us see what we have learning this session.
Delegate directive is used to create multi 10 conversation. We can also use elicit slot confirm slot all confirm intent for the same dialog state can be inserted in progress or completed. Here is intent that we have created. When dialog state is started we have checked whether the value is set or not. If not, then we have provided 24 as a default value and use a delicate balance To method to create delegate collecting and pass updating. When dialogue state is in progress, we have written empty directive.
And when dialogue state is completed we have just generated simple speech containing both slots. Thanks for watching this video. If you have any doubts, please feel free to contact me. Have a nice day.