In my bot i have an adaptive card with submit button. Can i modify card or disable button or delete this card on submit action ?
Asked
Active
Viewed 772 times
3
-
Would be good to share more details of your code and examples of the issue, but I believe I understand. You are saying that after the adaptive card is used (clicked on or whatever) you want it to go away so a user can't scroll back up and hit a button again? I don't know how to do that but I am interested in a solution as I can see how that could cause issues with your dialog flow. – billoverton Feb 13 '20 at 22:34
-
Hi Andrii Have you managed to do it? Because I only get 400 error when I try to execute UpdateActivity – Kostya Vyrodov Nov 22 '20 at 19:34
1 Answers
2
In Teams you have the option of updating your card message. So you can use something like:
var newActivity = MessageFactory.Attachment(myUpdatedCard);
newActivity.Id = activityId //the Id of the original activity you sent;
await turnContext.UpdateActivityAsync(newActivity, cancellationToken);
To send a new version of the card.

Andrew Clear
- 7,910
- 5
- 27
- 35
-
2WARNING!!! THIS CODE WORKING ONLY FOR TEAMS. NOT FOR EMULATOR. NOT FOR WEB CHAT. JUST TEAMS. – Андрі Нагуляк Feb 14 '20 at 15:10
-
2Yes, Teams is one of the bot channels that supports editing an existing message. Most channels do not. – Andrew Clear Feb 15 '20 at 01:30
-
1I get a forbidden error while doing this , anyone to help on this ? – Ashish Kumar Mar 02 '20 at 14:36
-
1You should only get a forbidden if the message was not created by the bot (the bot can only edit it's own messages) – Andrew Clear Mar 03 '20 at 22:50