I have a web api which gives me a list of people.
This is the list, requested it in Postman :
In my bot, I want to show this list to the user in ONE message.
When I use foreach
it sends a message for each person.
Here is the bot composer :
And here is the result :
Following picture is what I expect : (hardcoded)
How can I do this in composer ?
Thank you.
Use something like this (this is for an order but it's conceptually the same) in the output templates:
a template to format each item:
# orderItem(x)
- ```
- ${x.name} ${x.qty}
```
And then the template for the order:
# OrderDetails
- ```
ORDER: **${dialog.order.number}**
${join(select(dialog.order.items, x => orderItem(x)), '\n')}
```