【问题标题】:What is the correct way to send suggestions to the user with the [Suggestions] response type?使用 [建议] 响应类型向用户发送建议的正确方法是什么?
【发布时间】:2022-02-04 20:12:34
【问题描述】:

我已经尝试了好几个小时让 Composer 将建议发送回用户。如果点击该建议,我希望打开另一个网站。

首先,我创建了一个模板:

# urlCard(title, value)
[CardAction
    Type = openUrl
    Title = ${title}
    Value = ${value}
]  

如果我从英雄卡中使用它,这会很好,例如:

[HeroCard
      title = Click that button
      text = This is a test hero card
      buttons = ${urlCard( 'Google', 'https://google.com/' )}
    ]

但我无法获得与 [Suggestions 合作的建议:

[Suggestions
      SuggestionActions = ${urlCard( 'Google', 'https://google.com/' )}
    ]

这是我在 Bot Framework Emulator 中看到的:

如何在没有英雄卡的情况下向用户发送建议?

【问题讨论】:

  • Bot Framework 中没有名为“Suggestions”的结构。如果您尝试使用Activity 而不是Suggestions,会发生什么?

标签: botframework bot-framework-composer


【解决方案1】:

我没有使用 Composer 的经验,但我可以告诉您 Python API 的工作原理,也许它可以帮助您解决这个问题。
在 Python 中(JS 非常相似),您可以执行以下操作:

CardAction(title="Yes?", type=ActionTypes.im_back, value='yes')
CardAction(title="No?", type=ActionTypes.im_back, value='no')

用户做出选择后,建议的操作会消失,机器人将收到一条包含操作值的消息。但是,我认为您不能嵌入 URL,所以这可能是您遇到的实际问题。

【讨论】:

    【解决方案2】:

    这对我有用:

    [Activity
        SuggestedActions = ${openUrl( 'Google', 'https://google.com/' )}
    ]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-01
      • 2022-01-01
      • 2017-10-21
      • 2015-12-03
      • 1970-01-01
      相关资源
      最近更新 更多