Share feedback, ideas and get community help

Updated 7 hours ago

Persist variable value after closing session

Is it possible to persist the value of variable even after the user reaching the end of the flow (it means, closing session?)


Example:
I want to set the variable firstAccess=false in the first interaction

If the user come back two days later, I want to use a condition to check if the firstAccess=false or not and provide a personalized greeting:
"Hey, good to see you again :)"


(I tried to set a result variable. Whatsapp channel.)
t
v
2 comments
Looking at the code, on packages/bot-engine/src/startSession.ts there is a function getResult which will try to find an existingResult using the resultId, and then it would get its existing variables.

But I noticed two things:
  • startWhatsAppSession doesn't pass the resultId to the startSession function
  • Whenever a new session is created, a new different resultId is created
So, I think the existing variables won't be found because the resultId won't exist on database

I would need to change the code to keep the resultID with the same value as before, right?
hi!
maybe you can use an external database like nocodb
Add a reply
Sign up and join the conversation on Discord