Loop through HTTP response

(Anthonie De Klerk) #1

Hi, I am building a Telegram Bot for ordering home-baked bread. I have an rest API containing the products that returns something like this:
[
{name: ‘Sour dough’, price: 50.00},
{name: ‘Rye’, price: 35}
]

I want to loop through the output and create a card for each record.

Please assist how to access the records in the flow editor.

Regards,
Anthonie

(Nathan Stults) #2

Hello,

There isn’t a built in way to do generate multiple cards for a set of results. If you will have a limited number of results, say10 or less, you can add the 10 Send Card tasks into your flow and each one can have a filter that will only send the card if the item exists, something like {{my_api_call.data__1__name}} IS NOT EMPTY and the next card would be something like {{my_api_call.data__2__name}} IS NOT EMPTY, etc.