How to ignore user's message in Hook
# 🤝help
c
Hi guys, I'm using hooks to validate if a certainly condition happens, I want to ignore the user's message and do not send to the flow. Here's an example of the validation to check the message: - In the Before Incoming Message hookj, I validate if the userMessage is 'getOut', if does, then i set a workflow variable as true - In the After Incoming Message, I just check the workflow variable, if it's true, then I would to like to ignore the user's message and do nothing . I've been trying to do, but none of my code works, I tried to return null, return " ". But nothing appers to work. I found on my search this link: https://v12.botpress.com/building-chatbots/developers/hooks/ I'ts for the v12 version but has some code that make sense to me, like these part:
Copy code
javascript
const messageTypesToDiscard = ['session_reset', 'typing', 'visit', 'session_reference']

if (messageTypesToDiscard.includes(event.type)) {
  event.setFlag(bp.IO.WellKnownFlags.SKIP_DIALOG_ENGINE, true)
}
Is botpress cloud has something similar in the hooks that I could use? https://cdn.discordapp.com/attachments/1238586927813230623/1238586928475934902/Screenshot_2024-05-10_at_17.14.47.png?ex=663fd377&is=663e81f7&hm=21d6f61fa7ade493e5f7dafaeca96a8c6d8f6f90398bc9f073c38956ab95fe6f& https://cdn.discordapp.com/attachments/1238586927813230623/1238586929013063680/Screenshot_2024-05-10_at_17.12.12.png?ex=663fd377&is=663e81f7&hm=8e8a2b3a5940ea468bda052aad304c01c3761b839a005f507ec2845de0811862&
@crooked-van-25152 can you help me to tag someone to know?
@fresh-fireman-491 maybe you can help me, you know about hooks?
@acceptable-gold-88171 can you help me?
s
@crooked-petabyte-82330 you never got any help?
74 Views