问题
Hi i'm using adaptive Cards and want to generate a Submit Action which works in MS Teams as well as in Webchat.
In Emulator this works fine. After i'm clicking the Button its like the user would type in "Test" in the chat.
"actions": [
{
"type": "Action.Submit",
"title": "Test",
"data": "Test"
}
This doesnt work in MS Teams. How to bring this to work?
回答1:
My blog post explains that if you want to use a string submit action you will need to do it differently in Web Chat and Teams: https://blog.botframework.com/2019/07/02/using-adaptive-cards-with-the-microsoft-bot-framework/
If you want to have the same submit action work the same way in both channels, it will need to be an object submit action. If you want a string submit action to work on both channels then your bot will need to check which channel the activity came from and react accordingly.
回答2:
Please try the following sample adaptive card Json,
{"type":"AdaptiveCard","version":"1.0","body":[{"type":"TextBlock","text":"Imback Button"}],"$schema":"http://adaptivecards.io/schemas/adaptive-card.json","actions":[{"type":"Action.Submit","title":"Can you Help me","data":{"msteams":{"type":"imBack","value":"Can you help me"}}}]}
you can test adaptive cards in App studio app in Teams.
Hope this will help you. Thanks.
来源:https://stackoverflow.com/questions/61523621/how-to-rewrite-a-adaptive-card-submit-action-for-msteams-also-working-in-web-cha