如何在来自 microsoft bot composer 中的 json 的一条消息中创建多行响应?

时间:2021-05-02 23:33:02

标签: botframework bot-framework-composer

我有一个 web api,它为我提供了人员列表。

这是列表,在邮递员中请求:

List of people

在我的机器人中,我想在一条消息中向用户显示此列表。

当我使用 foreach 时,它会为每个人发送一条消息。

这是机器人作曲家:

enter image description here

这是结果:

enter image description here

下图是我所期望的:(硬编码)

enter image description here

我怎样才能在作曲家中做到这一点?

谢谢。

1 个答案:

答案 0 :(得分:1)

在输出模板中使用类似的东西(这是一个订单,但在概念上是相同的):

用于格式化每个项目的模板:

# orderItem(x)
- ```
- ${x.name} ${x.qty}
```

然后是订单模板:

# OrderDetails
- ```
ORDER: **${dialog.order.number}**

${join(select(dialog.order.items, x => orderItem(x)), '\n')}

```