How can I get a variable from chat and save it as a global variable so that I could use that same variable in other nodes too, in same Chatbot

I want to save user entered text as a variable, global variable, which could be saved for that given session, as value of that variable could be used in other nodes too, once saved in an initial node. How can I achieve this in botpress. I’m flexible with the botpress version, as far as I’m able to achieve above goal. Thanks in advance .

Hi @zakarian17s ,

There is a built-in action for that:

You can also create your own action to do the same

Okay Thanks @bassam.tantawi , I understand how to store global variable, but don’t know how to use those variables within actions or in node while giving text “On Enter”, followings are the steps Which I followed but failed to extract and show that Global Variable.


Set Variable like this, then tried to access same variable in action and node

Tried to access that saved variable as below in “On Enter” in the node

As above on Enter in node and also tried as below

But Failed in Both, can you please describe in more details, about accessing those set Global variables in actions file as well as in nodes.
Note :- Srry for messaging in fragments, as being a new user I can’t send more than one media in a chat.

Thanks in Advance

hi @zakarian17s

try using the “set variable” function instead of the “global” one. Then make it’s type as “temp”. When you want to use it, type “{{temp.variableName}}”

Thanks @bassam.tantawi. It did work,
Saved Temp Variable as Below :

Then use it as @bassam.tantawi told, as in my case Used as {{temp.user_name}}