https://discord.gg/botpress logo
Dynamic Flow Generation in Botpress: Is It Possibl...
# 🤝help
m
Is it possible to create automatic (dynamic) flows in Botpress that adapt based on user input or external data (like from an API), without manually building every branch? For example, I want to dynamically generate options or menus based on data retrieved from a database or a JSON file. Is this feature supported? And if so, what's the best approach to implement it?
l
Hey @mammoth-lifeguard-63559 Heres the typical impliment approach to implement it: - Use an "Execute Code" card to fetch or process external data. - Store the result in a variable. - Use conditional logic or dynamic content in your flows to present options/menus based on that variable. - You do not need to manually build every branch, you can use code and variables to generate content and transitions dynamically.
m
@loud-crowd-60573
Can you explain to me this point Use conditional logic or dynamic content in your flows to present options/menus based on that variable.
@loud-crowd-60573
l
Taking a look!
An example of this would be using conditional login in Execute Code Cards!
take a look here:
`` if (workflow.choice === 'OptionA') { // transition to node for OptionA } else { // transition to another node } ``
With this you can dynamically control the flow based on user input or data.
m
Now, can I make it like the three single choices? For example, I need to add options 4 and 5. All of these choices should be added dynamically. That means there will be a field that accepts user input, and based on this input, another choice will be added to the single-choice card. https://cdn.discordapp.com/attachments/1420154383915683891/1420444858971066550/Screenshot_-.png?ex=68d56bdc&is=68d41a5c&hm=34da6e09517d6410f4d22d3f29de76054743da07fe5a879d5f6bf57a5ed19753&
@loud-crowd-60573
(this is just a regular single choice card)
m
I mean can i add it dynimclly? And how if yes?
@loud-crowd-60573
l
Youll help yourself alot by exploring with Autonomous nodes. Give them the right instructions and they will help you do almost anything!
w
Hi @mammoth-lifeguard-63559 use the
{x}
option to insert your array variable, like suggested here: https://discord.com/channels/1108396290624213082/1121494527727902891/1131335058268102736
m
I think if we can we will also need to make publish so can we make also thar dynimiclly? @ross.botpress @white-nest-40686
I am using the card simg choise and this card calles items from api so i need when the user chose one of the select list to transit him to another card or event. is there a way to accomplish this? @ross.botpress @white-nest-40686 https://cdn.discordapp.com/attachments/1420154383915683891/1421269624279928872/IMG_20250927_015055_109.jpg?ex=68d86bfc&is=68d71a7c&hm=bc4b2ec47d0e0f543a95b9f815b13f0c1f6a5ed6e8d79ad1fcdb4a54b21e3999&
w
Put iteration cards below choise card and test
event.preview
message has been deleted
2 Views