-
Notifications
You must be signed in to change notification settings - Fork 40
activators
Each scenario's state can be activated by any of configured activator - a rule that tries to handle the user's request and find an appropriate state. Activators function is a builder function of scenario builder that adds activators to the state.
state("launch") {
activators {
event(AlexaEvent.LAUNCH)
intent(DialogflowIntent.WELCOME)
}
action {
...
}
}
Here is a top-level state "/launch" that can be activated by Alexa's LAUNCH event or Dialogflow's WELCOME intent.
As you can see, activators are linked with NLU engines that handle users' requests and recognise intent's name and extract named entities from the raw text of the request.
But JAICF supports not only intents and events. You can also use regex and catchAll activators.
Learn more about different activators here.
By default activators will activate the state only if the parent state was activated previously. You can configure activators to be global - in this case the state can be activated by these activators as it was a top-level.
state("main") {
state("inner") {
activators {
intent("some_intent")
}
globalActivators {
event("activate_inner_state")
}
}
}
In the example above state "inner" could be activated by two different activators - intent activator with "some_intent" intent's name and event activator with "activate_inner_state" event's name. Once the intent activator could activate this state only in case the parent "main" state was activated previously, the event activator is a global and can activate "inner" state from everywhere.
Activators function accepts an optional state path from where it is available. It means that you can "override" a parent's state path to make a state available from some other state.
state("main") {
state("inner") {
activators("/other") {
event("event1")
}
}
}
In the example above "inner" state can be activated once a dialogue is in state "/other". You can think about this as a mix-in feature.