The code samples in this section are based on version 4.6 and later versions of the Bot Framework SDK. If you are looking for documentation for earlier versions, see the bots - v3 SDK section in the Legacy SDKs folder of the documentation.
Your bot can dynamically update messages after sending them instead of having them as static snapshots of data. Messages can also be deleted using the Bot Framework's DeleteActivity method.
Update messages
You can use dynamic message updates for scenarios, such as poll updates, modifying available actions after a button press, or any other asynchronous state change.
It is not necessary for the new message to match the original in type. For example, if the original message contains an attachment, the new message can be a simple text message.
// Send initial messagevar response = await turnContext.SendActivityAsync(MessageFactory.Attachment(card.ToAttachment()), cancellationToken);var activityId = response.Id; // Fetch activity id.// MessageFactory.Text(): Specifies the type of text data in a message attachment.var newActivity = MessageFactory.Text("The new text for the activity");newActivity.Id = activityId;// UpdateActivityAsync(): A method that can participate in update activity events for the current turn.await turnContext.UpdateActivityAsync(newActivity, cancellationToken);
Now that you have updated messages, update the existing card on button selection for incoming activities.
Update cards
To update the existing card on button selection, you can use ReplyToId of incoming activity.
To update existing card on a button selection, pass a new Activity object with updated card and ReplyToId as activity ID to the UpdateActivityAsync method of the TurnContext class.
// Returns a message activity that contains an attachment.var activity = MessageFactory.Attachment(card.ToAttachment());activity.Id = turnContext.Activity.ReplyToId;// A method that can participate in update activity events for the current turn.await turnContext.UpdateActivityAsync(activity, cancellationToken);
Now that you have updated cards, you can delete messages using the Bot Framework.
Delete messages
In the Bot Framework, every message has its unique activity identifier. Messages can be deleted using the Bot Framework's DeleteActivity method.
To delete a message, pass that activity's ID to the DeleteActivityAsync method of the TurnContext class.
foreach (var activityId in _list){ // When overridden in a derived class, deletes an existing activity in the conversation. await turnContext.DeleteActivityAsync(activityId, cancellationToken);}
Code sample
The following code sample demonstrates basics of conversations:
Sample name
Description
.NET
Node.js
Python
Manifest
Teams Conversation Basics
This sample shows how to use different bot conversation events available in bot framework v4 for personal and teams scope.
Messages can be deleted using the Bot Framework's DeleteActivity method. To delete a message, pass that activity's ID to the DeleteActivityAsync method of the TurnContext class. To delete a message, pass that activity's ID to the deleteActivity method of the TurnContext object.
If a message is deleted after the person has seen it, it will disappear from the other person's Teams. This is the same whether the person has seen it or not.
Deleted chat or channel messages cannot be restored directly. If you have a compliance retention policy or legal hold in place for Teams messages, an administrator can recover these from the Compliance center via eDiscovery search. If compliance hasn't been enabled, the deleted messages are gone forever!
There's no option to delete a full chat in Microsoft Teams. But you should be able to delete or edit your own messages. If you have no delete option in Microsoft Teams, there could be a few reasons for this. Revoked privileges: If you can't delete a sent message, an admin may have removed this ability for you.
At the end of the retention period (30 days from day 1), the message is permanently deleted typically within 1-7 days after the minimum of 1 day, and then won't be returned with eDiscovery searches.
If you delete the message or conversation, the other person will still have a record of it. But it will appear on your phone like a new conversation. If you want to delete sent messages, you can use secure messaging apps like Telegram and Signal.
When a message is deleted in a private chat, an end-user does not have a way to recover the message, as it does not go to the Recycle Bin. It can be recovered by an administrator from the Compliance center via eDiscovery search. Not all MS Teams content is “eDiscoverable” – check this documentation for what is.
If you hide a conversation and then chat with that person again, your chat history reappears (if it's turned on). Delete conversation—Permanently deletes your copy of a conversation's history. It doesn't delete the conversation from other participants' history.
> Mute. next to the name of the bot you want to remove. Once you remove a bot, your teammates will no longer be able to @mention that bot in the team, and it will no longer be able to post to that team.
As far as i know, unfortunately, the status between desktop and mobile is not dependent to each other. The status is based on your activity on each devices so you will be needing to update manually the statuses for both devices.
You can delete old or unwanted conversations from Messages, move them into your archives, or mark all messages as read. Note: Some of the following steps only work on Android 6.0 and up. Generally, open the Message app, touch and hold each conversation, and tap Delete.
Introduction: My name is Dean Jakubowski Ret, I am a enthusiastic, friendly, homely, handsome, zealous, brainy, elegant person who loves writing and wants to share my knowledge and understanding with you.
We notice you're using an ad blocker
Without advertising income, we can't keep making this site awesome for you.