Advice on how to implement dynamic questions
Hello
I have an api that I can call in a chat flow. The response from this api is like this (in typescript)
Basically, its an array of questions that have multi choice options.
My first thought was that I would need write a loop that has a condition based on the length of the array.
Then I was thinking maybe its easier to dynamically generate the entire chat flow.
4 Replies
You should be able to create a loop by "popping" items from a list variable one by one until the list is empty.
But to be honest, it was not made for that so you will struggle with other part of the flow.
If you can generate the typebot before, yes using the API to create a new typebot is better I think!
Thanks @Baptiste
If you can generate the typebot before, yes using the API to create a new typebot is better I think!I've got a couple of questions related to this. 1. I see the json groups and blocks have unique ids. Do these need to be unique across the chat flow, or across all chat flows? 2. If I was to recursively use the
Link to typebot
feature, but with different variables, would you see any issues, eg, accurately storing chat stateHave you ever tried looping a block? For example an image block with an array that contains 3 images? I tried and viewer did freeze, I needed to restart it.
The IDs should be unique on the same typebot. It should be fine if there are similar IDs on other linked typebots.
Provide an example (in a new post), I can help you 🙂