I've created a bot using Microsoft Bot Framework Composer and displaying the following Adaptive Card. How can I determine what button is pressed when the message is submitted using Action.Submit and Task/Fetch?
{
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"size": "Medium",
"weight": "Bolder",
"text": "Publish Adaptive Card Schema"
}
],
"actions": [
{
"type": "Action.ShowCard",
"title": "Set due date",
"card": {
"type": "AdaptiveCard",
"body": [
{
"type": "Input.Date",
"id": "dueDate"
},
{
"type": "Input.Text",
"id": "comment",
"placeholder": "Add a comment",
"isMultiline": true
}
],
"actions": [
{
"type": "Action.Submit",
"title": "OK",
"data": {
"msteams": {
"type": "task/fetch",
"value": {
"option": "opt1"
}
}
}
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
}
},
{
"type": "Action.OpenUrl",
"title": "View",
"url": "https://adaptivecards.io"
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.3"
}
My bot correctly receives the submitted message, but I cannot tell which button is pressed. The following is an example of this.activity sent. I can see the msteams type is set to task/fetch, but cannot tell what button was pressed in the above card.
{
"type": "invoke",
"id": "",
"timestamp": "2021-06-29T16:57:27.551-05:00",
"localTimestamp": "2021-06-29T16:57:27.551-05:00",
"localTimezone": "America/Chicago",
"serviceUrl": "https://smba.trafficmanager.net/amer/",
"channelId": "msteams",
"from": {
"id": "",
"name": "Mike",
"aadObjectId": ""
},
"conversation": {
"conversationType": "personal",
"id": "",
"tenantId": ""
},
"recipient": {
"id": "",
"name": "csharpdemo"
},
"locale": "en-US",
"entities": [
{
"type": "clientInfo",
"locale": "en-US",
"country": "US",
"platform": "Windows",
"timezone": "America/Chicago"
}
],
"channelData": {
"tenant": {
"id": ""
},
"source": {
"name": "compose"
},
"legacy": {
"replyToId": ""
}
},
"replyToId": "",
"value": {
"data": {
"type": "task/fetch"
},
"context": {
"theme": "default"
}
},
"name": "task/fetch",
"callerId": "urn:botframework:azure"
}
It looks like I need to pass a value or data field in the msteams node but not sure how.
https://blog.botframework.com/2019/07/02/using-adaptive-cards-with-the-microsoft-bot-framework/
Teams Bot Adaptive Card action.Submit returns undefined but works in Bot Emulator
You can include additional hidden properties in the data object, if required.
{
"type": "Action.Submit",
"title": "submit",
"data": {
"msteams": {
"type": "task/fetch"
},
"Value1": "some value"
}
}