how can I declare a global variable inside action ...
# 🌎general
w
how can I declare a global variable inside action code of botpress cloud and use it other places in nodes as well as other actions in different workflow also in same chatbot?
a
Hey @worried-plumber-65401, you can't declare global vars from within a code card, but you can change them there. To declare a global var, go to Chatbot Settings > Variables and put your global vars there.
Bot variables are the closest thing to traditional global vars, in that they're the same all throughout the bot and can be used or changed anywhere. Config variables are more like env vars, they're best kept for secrets like API keys
w
I have already declared this as user Variables but not able to use it in actions when I write user.variable_name , it gives me error.
a
what error? Could you share a screenshot?
w
Yeah sure...
a
aaah, sometimes the linter doesn't update variable names and you can ignore those errors. When you talk to the bot, does it act as expected?
w
ah! I didn't checked it. Let me see.
Yeah It works fine, thanks Gordy
a
Glad to hear it! There's still some work being done on the Typing and variable checking backend processes. It's a bit too technical for me to understand, but they don't typically affect performance.
2 Views