How to store data into hooks


Hello, I need to store some functions into the variable “bp”. I really can do it in “actions” inside mybot. But when I try to do this in “global/hooks/after_bot_mount” the functions just disappear.

into mybot/actions: bp.myfunction = () => {console.log(“whatever”);}

still persistent between the dialogs

into global/hooks/after_bot_mount: bp.myfunction = () => {console.log(“whatever”);}

don’t persist between the dialogs

Does anyone knows how to do this?

Obs: don’t tell me to use because serialization is cleaning the functions.


Hi @arnaldobadin, you can’t declare functions like that. bp is a SDK and is not mutable like it was in v10. I’m not sure what you want to achieve but I could help you if you provide more details. Also, please refer to this section of the documentation for further details on actions and hooks.