Hello all,
I am attempting to migrate from Jovo 3 to Jovo 4 and so far have been having some difficulty due to the lack of examples (I learned Jovo 3 by working through the tutorials). The part I am currently stuck on is how best to fill in multiple slots using the new component model. Here’s my specific use-case:
I have a parent Intent called ScheduleMeetingIntent,
this intent then tries to extract three pieces of information from the user: Date, Time, and Topic. In Jovo 3, I chain states together to fill the slots: I have a ScheduleMeetingIntent handler that has a follow up state of GetDateState which has a follow up state of GetTimeState which has a follow up state of GetTopicState which then redirect to a CreateMeeting stateless intent which calls an external API and creates the meeting.
In Jovo 4 I have tried creating a parent component called ScheduleMeetingComponent that redirects to a DateComponent. However, the GetDateIntent is never triggered - when I prompt the user for the date, the answer keeps going to the DateComponent UNHANDLED method. What am I doing wrong? Also, can I collect the information to fill all 3 slots from the top level schedule meeting component (e.g. go to date and back to schedule meeting, then collect time and go back, etc.) instead of chaining the date, time, and topic components together?
Here are some code snippets to help visualize my questions:
ScheduleMeetingComponent.ts
@Component({
components:
[
UnbluDateComponent,
]
})
export class UnbluScheduledMeetingComponent extends BaseComponent {
START() {
console.log(`In START`)
return this.$redirect(UnbluDateComponent);
}
UNHANDLED() {
console.log(`UnbluScheduledMeetingComponent: UNHANDLED`)
return this.START();
}
}
DateComponent.ts
@Component({
components: [
UnbluTimeComponent
]
})
export class UnbluDateComponent extends BaseComponent {
START() {
console.log(`In UnbluDateComponent START`)
return this.$send({ message: 'What is the date of the meeting?', listen: true});
}
@Intents(['GetDateIntent'])
getDate() {
const date = this.$entities.date?.value;
console.log(`Getting date: ${date}`);
this.$session.data.date = date;
return this.$redirect(UnbluTimeComponent);
}
UNHANDLED() {
console.log(`UnbluDateComponent: UNHANDLED`)
return this.START();
}
}
en.json (for the date intent)
"GetDateIntent": {
"phrases": [
"the date is {date}",
"{date}"
],
"entities": {
"date": {
"type": {
"alexa": "AMAZON.DATE",
"dialogflow": "@sys.date"
}
}
}
},