I am working on a business requirement that involves the ability to update or delete proactive messages sent to Microsoft Teams using the Bot Framework. The update or deletion might occur long after the initial message was sent. I've come across a similar question on Stack Overflow that was answered with a sample code. However, when attempting to implement the provided solution, I encountered an obstacle related to the UpdateActivityAsync method's signature.
In the sample code, the method's signature differs from what is supported in my case. Specifically, the signature in my case requires an instance of ITurnContext as input, unlike the proposed signature in the sample code.
Here is the signature:
public override async Task<ResourceResponse> UpdateActivityAsync(ITurnContext turnContext, Activity activity, CancellationToken cancellationToken)
Note: I am using Microsoft.Bot.Builder.Integration.AspNet.Core ver 4.18.1
I would greatly appreciate any guidance or assistance in resolving this issue. If anyone has experience with updating or deleting proactive messages in Teams using the Bot Framework, your insights would be invaluable.
I have successfully resolved the issue and got it working. It appears that there is a crucial element known as message Id, distinct from both Activity Id and Conversation Id. The message Id is obtained from 'ResourceResponse.Id,' which is returned by the 'turnContext.SendActivityAsync()' method. Following the proactive message transmission, it is essential to retain two pieces of information (store them somewhere). When you later need to update or delete a previously sent message proactively, as an example, you can call the logic outlined below.