Botpress hooks : how does it work?

Hello community,
I am new to botpress and i like to build a bot with it. When i started with documentation i stumbled upon “hooks” and i didn’t really understand what they are meant for.
Can anyone explain it to me and maybe provide an example.
Thank you

Hi @sarra,

Welcome to the Botpress Community Forum! Hope you will share your experience with us :raised_hands:

There is an overview of the event engine in the documentation, where you will find that hooks are executed between certain steps when processing an event, for example a user-sent message.

There are a few examples of them in the Examples folder of the Code Editor. A common usage is to have a hook before incoming middleware, where you catch a certain phrase, such as “reset”, to skip processing and jump back to the first node of the flow. You could also alter the decision made by getting the results of NLU before suggestions election and choose a certain response from the suggestion following custom rules instead of the one having the best confidence.

Feel free to ask around for help with a particular thing you would like to make.

Happy Building :robot:

Thank you for answering, I will certainly look through these links for further documentation.