Storing and displaying arrays returned by an API
Hi, guys.
Suppose I have the following JSON as an API return and would like to store and display (in one or more text bubbles) each sale with their respective products's prices. What's the best way to do this?
7 Replies
Did you already try Save in variables ?
![No description](https://cdn.answeroverflow.com/1228081406807117985/image.png)
Mmmh that's a good question!
Since, there is
products
which is a nested list, we would be obligated to save the sales list in a variable and later on parse it with JSON.parse
So that's definitely not the easiest use case. It needs a bit of code.
Here is what I did: https://app.typebot.io/typebots/cluwg7tvc0001106bdrjxlc6j/edit
Let me know if it makes senseThat's exactly what I wanted. Thank you very much 🫡
Hi guys, I tried the example that @Baptiste showed, but I got this instead:
An error occurred while loading the bot.
{
"status": 408,
"body": {
"message": "15 seconds timeout reached",
"code": "TIMEOUT",
"data": {
"code": "TIMEOUT",
"httpStatus": 408,
"path": "startChatPreview"
}
}
}
Is this an connection error from my machine?
Make sure you made the right block connections with the arrows as it seems you caused an endless loop
I guess that the arrows are fine
I'm using some JSON data as you did in the Sales example. What am I missing?
I've been testing here, and the problem is that this infinite loop that you've mentioned @gk occurs when I connected the arrows, like this:
Without this connection I can run the bot, but without the value in the "Waste name" variable. Any ideias on why the script is not running?
Hi guys, I would like to join the conversation because it aligns with what I am looking for. I am interested in knowing if it is possible to create buttons from the product data, which would include an image, the product name, and a link/button to the product page.
Thank you for helping!