Never run the bot again on already contacted perso...
# 🤝help
p
Hey! I have a bot that's integrated with Whatsapp. I have created a variable (workflow.hasContacted) that is a boolean and is set to true at the end of the conversation. Its behaviour is pretty explanatory if the conversation ends the variable is set to true. At the start of the conversation the value of the hasContacted is being checked, if it's false then the user goes through my funnel, but if it's false (the user already went through my funnel) it says "We already have your application! Please contact us at [redacted] if you need more assistance!". However it's not working. Details: - hasContacted set up as a variable in Main Workflow properties - the checks for the hasContacted value are straight after the Start node. I have used Transitions with the type expression "workflow.hasContacted === true" and "workflow.hasContacted === false" - I am setting the workflow.hasContacted to false with "workflow.hasContacted = false;" in the Execution code card just before the End node. Thanks in advance.
f
Hey @prehistoric-gigabyte-35651 unfortunetaly the technical team is gone for the day. I would recommend commentting on the thread tomorrow morning EST to make sure the team sees this
p
Hey @freezing-printer-49373, thanks for the heads up!
f
no problem. (teams in usually at 9 EST FYI)
p
Bump
b
hey!
can you try your transitions with the condition
workflow.hasContacted
and
!workflow.hasContacted
just simply add these conditions for true or false behavior.
let me know how it goes!
p
Hey @bright-magazine-792, I have combined this with setting the hasContacted variable as a Default Value and now it works!
Thank ou!
Actually after more tests it doesn't work. Is it possible to set the workflow.hasContacted variable just before the Botpress flow ends to false and it saves the value of this variable in case the same user wants to contact the bot again?

https://cdn.discordapp.com/attachments/1136787629891915877/1137115195576172614/CleanShot_2023-08-04_at_21.06.462x.png

b
in that case, you need to use
user
variable instead of
workflow
variable https://botpress.com/docs/cloud/studio/variables/#how-to-make-user-variables
p
@bright-magazine-792 thank you! After some tests I can confirm that his issue has been solved.
b
perfect!
11 Views