Hey, this is Steve with Dabble Lab. In this video, we’re talking about using dialogs in custom Alexa skills.
So if you’ve got a skill that is going to have back and forth conversation with the user, that’s referred to as multi-turn conversation. The easiest way to do that is with dialogs which is what we’re going to talk about today. And as the demo I’m just going to create a simple skill VUI for sales coaching skill. And this skill is going to ask the user a couple of questions that it’s going to get the answers to and then just spit back what it hurts, so it’s just a pretty simple example but it illustrates how to use dialogs in custom skill.
So for starters, let’s see, we are going to go into the Developer Console and we’re going to create a new skill and I’m going to call this Sales Coach, like that. There is a really helpful tool that I came across recently in the alexa-cookbook, which if you go to github.com/alexa you can find it in the alexa-cookbook and then tools and then the VUI Testing Tool. I’ve already got this set up and I’ll show you how you can create, just kind of, a generic backend for your skill for testing voice user interfaces.
What we’re going to do is we’re just going to grab this code here and use it to create a Lambda Function, so I’m just copying that. I’m going to go over here now to aws.amazon.com. And if any of this is unfamiliar to you, I will leave links to other videos where I talk about this.
We’re going to create a Lambda Function, and so it’s got the Alexa Skills Kit and I’m just going to pick one of the blueprints that’s available and I’m going to call this sales-coach. I’m going to use the — that’s fine, and create this function. And it’s got some boiler plate coding here but we’re going to replace that with the code that we copied from, this VY tester over here. So once the Lambda Function is created, just go in here and then swipe all of that and then paste in the code for the VY testing tool and we got it in there. And now we can save it.
And then I need to copy the ARN, the Amazon Resource Name and then go back over to my skill that I just created and then go to configuration here and configure that generic backend, okay. Looks like the trigger wasn’t set for some reason. It appears to be set now. Let me try that again.
Okay. Now we’re all set. Now we can go over here to create our interaction model. And to do this, we’re going to use the Skill Builder Beta. And this makes creating interaction model really easy, especially if you’re using dialogs because the code for that, it’s just a JSON file but it can get involved quick. So this is just a really easy way to work with it.
So I’m going to go back here and look at my dialog that I have. So I’m asking three questions. And I’m going to have a single intent that’s going to ask the user what their sales goal is for the year, what their average commission or their average — how much they make per sale and then how many prospects they need to connect with to make a single sale on average. And then we’ll just going to play that back.
So we’ll start by creating an intent here and I’m going to call this CoachIntent and set my goals, the invocation or the utterance. And here, now we’re going to add those slots. And we’ve got three of them, so we’ve got these sales goal, we’ve got the average income and then we’ve got total prospects. So now I’m collecting three values here, they all happen to be for this example, they all happen to be numbers so it’s easy. So we’re going to use a built-in slot type. And all of these will use Amazon, the numbers that are grabbing.
Okay. So now I’ve got my CoachIntent and I’ve got my three slots. I need all of these, so I’m going to require all tree of them. So these are not optional, I need those. So I’m going to select require here and then if I go over to each one of them, this is where I can use the dialog model to prompt the user if the value isn’t provided. I don’t need to do this in my backend skill service, which makes it a whole lot easier. So for my sales goal, I will just ask the user – what is your — let me say something different. How much do you want to make in the next year? And the user is going to say to that, there are sales goal with is a number and then dollars.
And I’m going to confirm what they’ve said, so down here I can use slot confirmation to say “So you want to make sales goal dollars.” Then I’ll say, “All right. Ask the questions.” And then they should confirm yes or no there. If they confirm yes, it will move on to the next question; if they confirm no, it will in this case, replay and ask them again, prompt them again for their sales goal. So we’ll go on to their average income and will ask, “On average how much do you make from a single sale?”
And we’re going to confirm this also. I’ll say from one sale you make average income dollars on average. Correct. And then my total prospects is my last slot value here that I need to fill and we’re going to ask how many total prospects do you need to contact to make a single sale? And we’ll confirm this with “You need to contact total prospects to make a sale. Did I hear you right?”
Okay. So now we have our three slots and we have our prompts and actually we need some utterances here. I left out, so when we prompt these on an average, how much do you make from a single sale, we need to create an utterance on how the user is going to respond. And I think in this case, they are going to also say average dollars. I’ll just use one here, really should have, like, a list of these. But for this example, keep it simple.
And then total prospects, same thing. I left that out. So we’re saying how many total prospects do you need to contact to make a single sale on it. I think in this case they will probably just respond with a number, so we’ll just say, we’ll give the utterances just the slot value.
Okay. So now I think we’ve got all that. The last thing that I want to do just for this example is confirm all of this in the intent confirmation. So here after we’ve asked and collected the response for each one of these slots and confirm the response, the very last thing that we’re going to do is confirm the entire intent. So we’ll say, “So you want to make sales goal dollar this year, you make average dollar/income sale, and you need to contact total prospects to make a sale. Is that right?”
Okay. So now I think we have everything that we need to illustrate this and I’m going to go through it one more time. So I’ve got my new intent, my custom intent here called the CoachIntent, and to the utterance that we’re going to listen for is set my goals. So the usual say something like, ask sales manager to set my goals. And then we’re going to prompt them for their sales goal which is how much they want to make in a year. And then we’ve got the utterance that’s going to come back that we’re expecting is total dollars and then we’re going to confirm that, we’re going to do the same thing for each of these other ones.
And then finally, we’re going to confirm all of that with this confirmation message for the intent. So let’s save this and then build it and then we’ll test it. The build is going to take a minute so I’ll pause and come back. Okay. So the model is done building. Let’s go test it and see. So I’m going to turn my Alexa here and to start with this.
Alexa: 00.44 miles. 0.71 km, east to the —
Steve: Alexa, stop.
And sales-coach. Okay. And we’re getting our response back from our stumped out skill service. So everything looks like it should be working. Now we’ll test it for real.
Steve: Alexa, ask sales coach to coach me or to set my sales goals. Alexa, ask sales coach to set my sales goals.
Alexa: How much do you want to make in the next year?
Alexa: So you want to make $150,000, right?
Steve: That’s right.
Alexa: On average, how much do you make from a single sale?
Alexa: From one sale you make $20,000 on average, correct?
Alexa: How many total prospect do you need to contact to make a single sale?
Alexa: You need to contact 25 prospects to make a sale. Did I hear that right?
Steve: Yes, you did.
Alexa: So you want to make $150,000 this year? You make $20,000 per sale and you need to contact 25 prospect to make a sale; is that right?
Steve: That’s right.
Alexa: Your endpoint received the request. Here’s a breakdown.
Steve: Alexa, stop.
So that’s it. That is how easy it is to setup an interaction model using dialogs. I’m going to wrap this video up with that, but I will do a future video that talks about working with the dialog interface in the skill service and lambda backend but that’s it for now.
Hopefully, this was valuable. If you have any comments or questions, you can leave those and I’ll respond just as quickly as I can. If you did think the video was value, please like it and subscribe to the Dabble Lab channel. Thanks so much.