How to get message back from Adaptive card

偶尔善良 提交于 2019-12-24 18:56:25

问题


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"
    }
]

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

The issue:


回答1:


I think you have a few options

Option #1

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.

Option #2

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.

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.

Option #3

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/



来源:https://stackoverflow.com/questions/57811313/how-to-get-message-back-from-adaptive-card

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!