Base Intents
The Base Intents module adds handling for necessary intents such as the welcome intent to a project.
- 1 Dependencies
- 2 Intents Handled
- 2.1 Launch
- 2.2 None Intent
- 3 Handlers
- 3.1 afterLaunch
- 3.2 fallback
Dependencies
The Base Intents module is dependent on the following modules:
Intents Handled
Launch
The module handles the launch intent by checking for a launch flow ID in custom data (at the path msg.payload.originalDetectIntentRequest.payload.customData.launchFlowId) or the settings (at the path flow.launch.id). If there is a launch flow specified, it will attempt to launch that flow, otherwise, it will give a standard welcome message based on the project description.
If both are specified, the custom data launch flow ID will take precedence. If msg.launchFlowId is already set by the afterLaunch handler, that will take precedence over both.
None Intent
The module handles the none intent for no state and any state. When it fires, the registered fallback handler will fire. A default fallback handler is registered that will respond with the message “Sorry, I didn't understand you. Could you repeat that?“.
Handlers
Handlers for the following events can be registered by calling baseIntents.registerHandler and passing it the handler key:
afterLaunch
This handler is executed after the launch node has fired but before the launch flow (or default message) is provided. The handler can be asynchronous and modifications made to the msg object by the handler will be carried forward. The handler can set msg.launchFlowId to force a particular launch flow.
The handler is passed the following parameters:
msg (object): The Node-RED message object.
fallback
This handler is executed after the none intent has fired.
The handler is passed the following parameters:
msg (object): The Node-RED message object.