I need to create an intent with multiple slots and alexa to ask for values of each slot one at a time.
The slots are like this:
- startdate
- enddate
- activity
- contactid
I initially wrote my the model like this:
{
"name": "ActivityIntent",
"phrases": ["{startdate, enddate, activity, activitycontactid}"],
"inputs": [
{
"name": "startdate",
"type": { "alexa": "AMAZON.DATE" },
"phrases": [
"start date is {startdate}",
"{startdate}",
"start with {startdate}"
]
},
{
"name": "enddate",
"type": { "alexa": "AMAZON.DATE" },
"phrases": [
"end date is {enddate}",
"{enddate}",
"end with {endtdate}"
]
},
{
"name": "activity",
"type": { "alexa": "AMAZON.Person" },
"phrases": ["give me {activity} activity report", "{activity}"]
},
{
"name": "activitycontactid",
"type": { "alexa": "AMAZON.NUMBER" },
"phrases": [
"{activitycontactid}",
"i want a report on {activitycontactid}",
"give me a report for {activitycontactid}"
]
}
]
}
But after building the model, it ignored the phrases inside each slot and did not add them in alexa compatible model. Probably phrases
cannot be added inside a slot definition.
But then I realized I need to ask user question for each slot as well as user has to reply back with a value. So I compared with another skill which I created directly on alexa console and this looks like (here each slot has samples
):
"name": "PersonIntent",
"slots": [
{
"name": "firstName",
"type": "AMAZON.US_FIRST_NAME",
"samples": [
"My first name is {firstName}",
"First name is {firstName}",
"{firstName}"
]
},
{
"name": "lastName",
"type": "LAST_NAME",
"samples": [
"My last name is {lastName}",
"Last name is {lastName}",
"{lastName}"
]
},
]
and each of these slot has an utterance which alexa will ask user like when asking for first name. alexa asks me What is your first name, and so on. Those are placed in this skill’s JSON like this:
dialog: {
intents:[
"name": "PersonIntent",
"delegationStrategy": "ALWAYS",
"confirmationRequired": false,
"prompts": {},
"slots": [
{
"name": "firstName",
"type": "AMAZON.US_FIRST_NAME",
"confirmationRequired": false,
"elicitationRequired": true,
"prompts": {
"elicitation": "Elicit.Slot.1352805828328.1198316563612"
}
},
{
"name": "lastName",
"type": "LAST_NAME",
"confirmationRequired": false,
"elicitationRequired": true,
"prompts": {
"elicitation": "Elicit.Slot.1352805828328.939347850947"
}
},
]
]
}
Here is the complete JSON of the skill I created at alexa console with multiple slots for one intent:
{
"interactionModel": {
"languageModel": {
"invocationName": "interview process",
"intents": [
{
"name": "AMAZON.FallbackIntent",
"samples": []
},
{
"name": "AMAZON.CancelIntent",
"samples": []
},
{
"name": "AMAZON.HelpIntent",
"samples": []
},
{
"name": "AMAZON.StopIntent",
"samples": []
},
{
"name": "AMAZON.NavigateHomeIntent",
"samples": []
},
{
"name": "iAmReady",
"slots": [
{
"name": "firstName",
"type": "AMAZON.US_FIRST_NAME",
"samples": [
"My first name is {firstName}",
"First name is {firstName}",
"{firstName}"
]
},
{
"name": "lastName",
"type": "LAST_NAME",
"samples": [
"My last name is {lastName}",
"Last name is {lastName}",
"{lastName}"
]
},
{
"name": "streetAddress",
"type": "AMAZON.StreetAddress",
"samples": [
"{streetAddress}"
]
},
{
"name": "yourCity",
"type": "AMAZON.US_CITY",
"samples": [
"I live in {yourCity}",
"{yourCity}"
]
},
{
"name": "yourState",
"type": "AMAZON.US_STATE",
"samples": [
"{yourCity} comes under {yourState}",
"{yourCity} falls under {yourState}",
"{yourState}"
]
},
{
"name": "zipCode",
"type": "ZIP_CODE",
"samples": [
"{zipCode}"
]
},
{
"name": "phoneNuber",
"type": "AMAZON.PhoneNumber",
"samples": [
"{phoneNuber}"
]
},
{
"name": "emailAddress",
"type": "EMAIL_ADDRESS",
"samples": [
"{emailAddress}"
]
}
],
"samples": [
"I am ready"
]
},
{
"name": "fakeIntent",
"slots": [],
"samples": [
"fake intent"
]
}
],
"types": [
{
"name": "EMAIL_ADDRESS",
"values": [
{
"name": {
"value": "[email protected]"
}
},
{
"name": {
"value": "[email protected]"
}
}
]
},
{
"name": "ZIP_CODE",
"values": [
{
"name": {
"value": "11001"
}
}
]
},
{
"name": "LAST_NAME",
"values": [
{
"name": {
"value": "Sarkar"
}
}
]
}
]
},
"dialog": {
"intents": [
{
"name": "iAmReady",
"delegationStrategy": "ALWAYS",
"confirmationRequired": false,
"prompts": {},
"slots": [
{
"name": "firstName",
"type": "AMAZON.US_FIRST_NAME",
"confirmationRequired": false,
"elicitationRequired": true,
"prompts": {
"elicitation": "Elicit.Slot.1352805828328.1198316563612"
}
},
{
"name": "lastName",
"type": "LAST_NAME",
"confirmationRequired": false,
"elicitationRequired": true,
"prompts": {
"elicitation": "Elicit.Slot.1352805828328.939347850947"
}
},
{
"name": "streetAddress",
"type": "AMAZON.StreetAddress",
"confirmationRequired": false,
"elicitationRequired": true,
"prompts": {
"elicitation": "Elicit.Slot.1352805828328.697843016744"
}
},
{
"name": "yourCity",
"type": "AMAZON.US_CITY",
"confirmationRequired": false,
"elicitationRequired": true,
"prompts": {
"elicitation": "Elicit.Slot.1352805828328.794835807148"
}
},
{
"name": "yourState",
"type": "AMAZON.US_STATE",
"confirmationRequired": false,
"elicitationRequired": true,
"prompts": {
"elicitation": "Elicit.Slot.1353763301158.639242474037"
}
},
{
"name": "zipCode",
"type": "ZIP_CODE",
"confirmationRequired": false,
"elicitationRequired": true,
"prompts": {
"elicitation": "Elicit.Slot.1352805828328.170611106719"
}
},
{
"name": "phoneNuber",
"type": "AMAZON.PhoneNumber",
"confirmationRequired": false,
"elicitationRequired": true,
"prompts": {
"elicitation": "Elicit.Slot.1353763301158.715705151837"
}
},
{
"name": "emailAddress",
"type": "EMAIL_ADDRESS",
"confirmationRequired": false,
"elicitationRequired": true,
"prompts": {
"elicitation": "Elicit.Slot.1352805828328.713279428622"
}
}
]
}
],
"delegationStrategy": "ALWAYS"
},
"prompts": [
{
"id": "Elicit.Slot.1352805828328.1198316563612",
"variations": [
{
"type": "PlainText",
"value": "What is your first name?"
}
]
},
{
"id": "Elicit.Slot.1352805828328.939347850947",
"variations": [
{
"type": "PlainText",
"value": "What is your last name?"
}
]
},
{
"id": "Elicit.Slot.1352805828328.697843016744",
"variations": [
{
"type": "PlainText",
"value": "Please tell us your street address. Prefix house or apartment number to the street address."
}
]
},
{
"id": "Elicit.Slot.1352805828328.794835807148",
"variations": [
{
"type": "PlainText",
"value": "Which city do you live in?"
}
]
},
{
"id": "Elicit.Slot.1352805828328.170611106719",
"variations": [
{
"type": "PlainText",
"value": "You are doing great. Please tell us your Zip or Area Code."
}
]
},
{
"id": "Elicit.Slot.1352805828328.713279428622",
"variations": [
{
"type": "PlainText",
"value": "Here comes the last one. Please provide your email address. Make sure you are providing us an active email address and have access to it."
}
]
},
{
"id": "Elicit.Slot.1353763301158.639242474037",
"variations": [
{
"type": "PlainText",
"value": "Which state does {yourCity} come under?"
}
]
},
{
"id": "Elicit.Slot.1353763301158.715705151837",
"variations": [
{
"type": "PlainText",
"value": "Thank you for your persistance. Please provide us your phone number for future communications."
}
]
}
]
}
}
Sorry for such a long post. I only wanted to make sure that I put everything in place.
How do I write a model in JOVO which builds to something like above? A sample model to accomplish the above scenario would be a great help.