The prehook is a middleware introduced to customize the payload before sending in the request to the intent nodes.
All the intent type requests except for launch, session end, listener event nodes can trigger the prehook nodes based on the configuration.
Pre Hook Request node
Before triggering the intent, the Pre Hook Request node will be triggered.
Name - Custom name given to the node.
Skill - The project name.
Intent - You can choose the intents for which this Pre hook request node should be triggered. The Prehook request node will be triggered for the intents listed in this field irrespective of the state.
Pre Hook Response node
Name - Custom name given to the node.
In the below example, using login intent will invoke the login directive if the user is not logged in.
When the Login intent is invoked by the chatbot user, the prehook node is invoked and checks if the user is logged in or not. If the user is not logged in, the login directive will be invoked.
handleRequest - true, the actual flow wont get executed.
handleRequest - false, preHookData is filled, then it will get triggered before the actual response.