Share feedback, ideas and get community help

Updated 6 days ago

Where are Typebot variables stored?

At a glance
The community member wants to edit the value of multiple variables at once in a Script block, but they couldn't find where Typebot variables are stored. They also requested an "Auto Jump back" feature that would dynamically jump back to the previous blocks group when the group it jumped to has finished its execution. Another community member suggested using the setVariable function, which the original poster found helpful. The community members also discussed the desire to have a "function-like" group of blocks that could be called on-demand, similar to a function in programming, to handle tasks like name validation. However, the current state of Typebot does not support this functionality.
Useful resources
I want to edit the value of multiple variables at once in a Script block, but for that I'd need to know if/how to set a Typebot variable's value within a Script block, as I couldn't find where they are stored.

I haven't seen them being stored in localStorage, in window.Typebot or anywhere else.

P.S. I wouldn't need to know that information if a specific feature were implemented:
An "Auto Jump back" feature, which would dynamically jump back to the previous blocks group when the group it jumped to has finished its execution, as previously requested in another post.
A
B
9 comments
In my flow, before every text bubble, I am manually setting a variable to a custom value, which is the name of the character speaking and their current emotion as one string.
From this variable, I then update the value of 2 other variables: one that grabs the character name (first word of the previous variable), and another that returns the custom avatar URL corresponding to that emotion for that character.

Currently, I have to duplicate these 3 blocks every time, and I'd like to have a function-like group that would take care of updating the 2 variables from the first one I manually set.
Attachment
image.png
Have you checked the setVariable function?
Ooh, it seems like I had missed that. Nice! So I could combine all of this into one Script block πŸ‘Œ
Though there is no way to have a function-like blocks group, that we could go back to as we need, right?

Consider the following goal:
Every time a name-like string is asked to be inputted by the user, a Name validation function/groups of blocks should be executed, which should continue the flow normally if the name has passed the regex validation, otherwise display a specific text bubble/message.

Imaginary flow to illustrate it:
Attachment
image.png
Of course, the flow on my screenshot won't work properly with the current Jump blocks, but it illustrates my goal, which is to execute a set of blocks on-demand, and go back to where it was called after it finished executing, allowing for a DRY (Don't Repeat Yourself) flow, aka not duplicating the Name Validation group every time I need it but simply "calling it", much like a function in programming.

So the desired behavior with the above (incomplete) flow should be:
  1. Bot asks for the user's first name (assume it is then stored in a variable)
  1. The first name goes through a Name validation check script:
    • if the name passes the validation, the execution continues, meaning it jumps back to the end of firstName Input and in our case goes over to the next group of blocks dogName Input
    • if the name doesn't pass the validation, it could display a Text bubble and Jump to the original name input (which should be dynamically specified, given the expected behavior)
  1. Bot asks for the user's dog's name (assume it is stored in a variable)
  1. Same as 2. but for the dog's name
It is currently not possible to do that with the current state of Typebot, right? Just to be sure
Maybe I could store a function in the client-side window object, that I could call on demand whenever I need it πŸ€”
You could instead of using the Jump block, use the Typebot link block set to "Current typebot", it should work. This is what I did in the Skin Typology template
I am implementing a new Pod feature that will do exactly this, take specific inputs and can be reused by any of your bots
Add a reply
Sign up and join the conversation on Discord