Hello everyone, I need a bit of help with session handling in Botpress.
Iām building a chatbot where the first thing the bot should do is listen to the userās question.
So Iāve set up the following:
⢠A āconversation startedā trigger that goes to a node containing a Raw Input card.
⢠The Raw Input captures the userās question, sends it to an OpenAI card, and then loops back to listen again.
The problem Iām solving is this:
If I only use a āstartā node (without the āconversation startedā trigger), the first user message is used just to activate the bot ā it doesnāt actually get answered. So I added the āconversation startedā trigger to ensure the bot starts listening immediately, and that works fine for new users.
However, Iāve hit an issue with returning users:
If someone uses the bot, then closes the page or leaves, and comes back later, Botpress seems to recognize them (probably based on the userId), so it doesnāt fire the āconversation startedā trigger again.
But during that time, I think the bot session has expired or gone inactive, so the bot is no longer in listening mode.
What happens is:
⢠The returning user types a question.
⢠The bot wakes up, but goes into listening mode only after that message.
⢠So that first message is ignored
⢠Only if they send a second message, the bot responds.
So my question:
How can I automatically re-enter the listening state for returning users (after session expiry), so their first message after returning gets captured and answered?
Any best practices or recommended workarounds for this session edge case?
Thanks a lot š