如何从自适应卡取回消息 [英] How to get message back from Adaptive card

查看:151
本文介绍了如何从自适应卡取回消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用具有2个动作的自适应卡.

I use an adaptive card that has 2 actions.

"actions": [

    {
      "type": "Action.Submit",
      "title": "Cards related queries",
      "data": "Cards_intent"
    },
    {
      "type": "Action.Submit",
      "title": "Accounts related queries",
      "data": "Accounts_intent"
    }
]

但是,当用户选择执行操作时,我不希望用户看到聊天框中显示的"Accounts_intent".相反,我希望显示与帐户相关的查询"

But when the users select on action, I don't want the user to see "Accounts_intent" displayed in the chat box. Instead, I want "Accounts related queries" to be displayed

问题:

推荐答案

我认为您有一些选择

如果您想继续使用自适应卡,而您唯一关心的是对话历史记录中显示的内容,只需将data属性中的字符串更改为您想要显示的内容即可.

If you want to keep using an Adaptive Card and your only concern is what shows up in the conversation history, just change the string in the data property to whatever you want to be displayed.

{
  "type": "Action.Submit",
  "title": "Accounts related queries",
  "data": "Accounts related queries"
}

您的漫游器必须知道如何以与帐户相关的查询"为文本来响应活动.请记住,用户还可以键入与帐户相关的查询"来获得相同的结果.

Your bot must know to respond to an activity with "Accounts related queries" as the text. Keep in mind that the user would also be able to type "Accounts related queries" to achieve the same result.

如果您使用字符串作为提交操作数据,则您的卡必须没有任何输入字段.这意味着您可以使用任何种类的Rich Card代替Adaptive Card,或者甚至可以使用建议的操作.

If you are using strings as your submit action data, your card must not have any input fields. This means you can use any kind of rich card instead of an Adaptive Card, or you could even use suggested actions.

如果您确实希望活动包含与用户在对话历史记录中看到的内容不同的文本,则只能在支持该内容的渠道上执行此操作. Facebook Messenger允许您执行此操作,但它不支持自适应卡.拥有一组可见文本和另一组隐藏数据通常称为messageBack卡片操作.

If you definitely want your activity to contain different text from what the user sees in the conversation history, you will only be able to do this on channels that support it. Facebook Messenger lets you do this, but it does not support Adaptive Cards. Having one set of visible text and another set of hidden data is often called a messageBack card action.

如果您不关心用户在对话历史记录中看到任何内容,则可以使用craigbot的想法,即将Submit操作的数据作为对象而不是字符串,或者可以在Rich Card中使用card操作除了自适应卡.

If you don't care about the user seeing anything in the conversation history, you can either use craigbot's idea of having the submit action's data be an object instead of a string, or you can use a card action in a rich card other than an Adaptive Card.

如果您想了解有关自适应卡的更多信息,尤其是提交操作,请查看我最新的博客文章:

If you'd like to learn more about Adaptive Cards and especially submit actions, please have a look at my latest blog post: https://blog.botframework.com/2019/07/02/using-adaptive-cards-with-the-microsoft-bot-framework/

这篇关于如何从自适应卡取回消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆