Share via


Allow users to delete bot messages in Teams

The growing catalog of Copilot features and agents in Teams means that your users' chats could include messages from bots, like Facilitator. Your users may find times when the bot's messages are inaccurate, out of date, or irrelevant. In these scenarios, your users may want to delete a bot's messages.

In order to allow users to delete bot messages in Teams, you need to turn on the Users can delete messages sent by bots setting in the Teams admin center or by using PowerShell.

Considerations for deleting bot messages

  • The Users can delete messages sent by bots setting is turned off by default.
  • Any user in a chat can delete bot messages, including guests, external, and anonymous users.
  • When a use deletes a bot message, the message is deleted for all users in that chat. Once deleted, the bot's message is replaced by a message indicating the message was deleted.
  • Only the user who deleted the bot message in a chat can restore the deleted message, which makes the message visible again to the entire chat.
  • Adjusting the Users can delete messages sent by bots setting affects all communications in Teams including 1:1 chats, group chats, all channels, and meeting chats.

Allow delete bot messages in the Teams admin center

The Users can delete messages sent by bots setting is a messaging policy and can be managed in the Teams admin center. To manage this setting, complete the following steps:

The legacy Teams admin center experience

  1. Sign in to the Teams admin center with your admin credentials.
  2. In the left-side menu, expand the Messaging section.
  3. Select Messaging policies from the menu.
  4. On the Messaging policies page, change the toggle to On for Users can delete messages sent by bots.
  5. Select the Save button.

Change the setting for guests (legacy experience)

  1. Sign in to the Teams admin center with your admin credentials.
  2. In the left-side menu, expand the Users section.
  3. Select Guest access from the menu.
  4. On the Guest access page, find the Messaging section.
  5. Change the toggle to On for Users can delete messages sent by bots.
  6. Select the Save button.

The new Teams admin center experience

  1. Sign in to the Teams admin center with your admin credentials.
  2. In the left-side menu, select Settings & policies.
  3. On the Settings & policies page, choose either the Global (Org-wide default) settings or the Custom policies for users & groups tab.
  4. Once you choose the policy to change, select Messaging from the list of setting categories.
  5. Change the toggle to On for Users can delete messages sent by bots.
  6. Select the Save button.

Change the setting for guests (new experience)

  1. Sign in to the Teams admin center with your admin credentials.
  2. In the left-side menu, select Settings & policies.
  3. Find the External collaboration section, and select Guest access.
  4. On the Guest access settings page, find the Messaging section.
  5. Change the toggle to On for Users can delete messages sent by bots.
  6. Select the Save button.

Allow delete bot messages using PowerShell

You can also use PowerShell commands to update CsTeamsMessagingPolicy to allow users to delete bot messages. The UsersCanDeleteBotMessages parameter can be set to either $true or $false.

  • To update an existing CsTeamsMessagingPolicy policy, use the following code snippet. Make sure to update the Identity parameter, which defines an existing policy name for this setting.

        Set-CsTeamsMessagingPolicy -Identity [PolicyName] -UsersCanDeleteBotMessages $true
    
  • If this policy isn't already assigned to any users, assign this messaging policy to users with the following Grant-CsTeamsMessagingPolicy code snippet. In this context, the Identity parameter is the users' names or group you're assigning the policy to, and PolicyName is the name of the policy with the UsersCanDeleteBotMessages setting turned on.

        Grant-CsTeamsMessagingPolicy -Identity [UserGroupName] -PolicyName [PolicyName]