https://discord.gg/botpress logo
Variable Logic
# 🤝help
l
@quiet-raincoat-85414
q
ye
l
Just to summarize you want to set it one time like user gives his name and grade and then its permanently stored for all convos.
q
yes
what blocks do i use
l
The way you have your workflow setup, its redefining a new "user" every time you restart.
How many "students" are you working with in total?
or is it only one
q
i first have a greeting, then it checks if username is registered with !!user.username and !user.username im just testing this. if the username isnt registered it asks to register
after regiteration it takes you to ai node
but if i click that restart conversation button the variables are saved but the moment i click test the bot it resets to nothing
i feel like some way to add a default for every user
is there something like user.username.defaultvalue and i could set it using code blocks
l
Doing some digging and will get back!
drop screenshots of your workflow so we have it here @quiet-raincoat-85414
q
yes sir
you can see there are user variables
w
1. In
Get_Username
card you're using
workflow.UserName
instead of
user.workflow
😉 2.
!!user.UserName
(a double not is yes) is the same as
user.UserName
3. you don't need to check if exists and not exists
l
@quiet-raincoat-85414
q
yes
q
alright changed it to user.Username but still no let me make an exact replica of yours then
q
i have fixed this but still nope t doesnt work
u know what @loud-crowd-60573 @white-nest-40686 can u just send me a file that i can import and then ill recreate the other things cuz this is taking too long
like u guys can send me a json file in which u made that example flow
ill import it
and configure other nodes
@loud-crowd-60573 @white-nest-40686 ???
isnt there a permanent variable like there are temporary variables(temp.)
l
I cant get a solution right away @quiet-raincoat-85414
q
its okay
l
I'll need some time when others get back they'll help find a solution!
i'll drop you a ping when it's time!
q
alright
thanks for ur time
w
User should be permanent. Try - create a new simple workflow and create a flow same as my picture - connect START node to a node with the new workflow and test in emulator and the published bot.
w
another thing you can do, in addition of what Zannax already said, is to use table, which can be seen as "permanent storage" you create a usersTable, for which you can store a user name, and everything else you want (i.e. create a user profile as well) and then you search in the table if there's a correspondance for a specific username for instance
w
I've conducted a test and confirmed that in the emulator, a new conversation resets user variables, which I believe is the right behavior. However, in the published bot, user variables remain permanent. @quiet-raincoat-85414
q
hmmm it still doenst work somehow u know what can you either send me the workflow u have as a test or can u tell me how i cna make my bot interact with my own app like its parameters like username and grade are autmatically loaded each chat. Or Anyway i Can Introduce an Memory that the bot can edit itself or each user to botpress https://cdn.discordapp.com/attachments/1433119965535404174/1433422008024301578/30.10.2025_16.44.47_REC.mp4?ex=6904a1c6&is=69035046&hm=a3dca59e3e7c2dd6996186df0a7bed1020213d11a27605b7a0c904df213f78e2&
can I make it so that the variables in my bot are provided by my app that i make
l
hey @white-nest-40686 do you mind dropping that file of that bot so he can get hands on learning experience 🙏
q
Thats soo nice of You
😊
i have found the solution with just the user var btw now it was a typo
this is incomplete let me complete it
ill just take 30 minutes starting timer now
i ahve found the solution with just the user var btw now it was a typo this is incomplete let me complete it ill just take 30 minutes starting timer now
Done With 14:40 Remaining On the Clock
What do you think of it
w
q
oh okay i didnt know that
but they would execcute in order right?
w
all cards inside a node are execute in top down order
q
okay👍👍👍
w
to stop execution between cards you use transition card
q
that basically means you can put in one standard node to control all the non ai stuff and one ai node
w
it depends, some steps need to be splitted in different nodes, look in Table workflow