Updates from: 10/26/2024 01:09:25
Service Microsoft Docs article Related commit history on GitHub Change details
platform Conversation Messages https://github.com/MicrosoftDocs/msteams-docs/commits/main/msteams-platform/bots/how-to/conversations/conversation-messages.md
async onTeamsMessageSoftDelete(context) {
## Send suggested actions
-The suggested actions enable your bot to present buttons that the user can select to provide input. Suggested actions enhance user experience by enabling the user to answer a question or make a choice with selection of a button, rather than typing a response with a keyboard.
-When the user selects a button, it remains visible and accessible in the rich cards, but not for the suggested actions. This prevents the user from selection of stale buttons within a conversation.
-
-To add suggested actions to a message, set the `suggestedActions` property of an [activity](/azure/bot-service/rest-api/bot-framework-rest-connector-api-reference) object to specify the list of [card action](/azure/bot-service/rest-api/bot-framework-rest-connector-api-reference) objects that represent the buttons to be presented to the user. For more information, see [`sugestedActions`](/dotnet/api/microsoft.bot.builder.messagefactory.suggestedactions).
-
-The following is an example for implementation and experience of suggested actions:
-
-``` json
-"suggestedActions": {
- "actions": [
- {
- "type": "imBack",
- "title": "Action 1",
- "value": "Action 1"
- },
- {
- "type": "imBack",
- "title": "Action 2",
- "value": "Action 2"
- }
- ],
- "to": [<list of recepientIds>]
- }
-```
-
-The following illustrates an example of suggested actions:
--
-> [!NOTE]
->
-> * `SuggestedActions` are only supported for one-on-one chat bots with both text based messages and Adaptive Cards.
-> * `SuggestedActions` aren't supported for chat bots with attachments for any conversation type.
-> * `imBack` is the only supported action type and Teams display up to six suggested actions.
## Teams channel data
platform Prompt Suggestions https://github.com/MicrosoftDocs/msteams-docs/commits/main/msteams-platform/bots/how-to/conversations/prompt-suggestions.md
+
+ Title: Add Prompt Suggestions
+
+description: Learn how to create and handle a prompt starter and suggested actions for your Microsoft Teams bot to help your users initiate conversations.
+
+ms.localizationpriority: medium
+ Last updated : 10/25/2024++
+# Create prompt suggestions
+
+Prompt suggestions are commands that are presented to the users in the Microsoft Teams chat.
+
+Prompt suggestions create an engaging and insightful user experience and help your bot to acquire and retain users by showing them the value of your bot through prompt conversations. You can use prompt suggestions to help your users initiate conversations with your bot and learn how to interact with it.
+
+There are two types of prompt suggestions that you can use:
++
+##### [Prompt starters](#prompt-starters)
+
+Prompt starters help users start a conversation with your bot.
++++
+##### [Suggested actions](#suggested-actions-1)
+
+Suggested actions help users continue conversations with your bot.
++++
+## Prompt starters
+
+>[!NOTE]
+> * Your bot can either use a prompt starter or a welcome message. If your bot uses prompt starters, ensure that your bot doesnΓÇÖt send a welcome message.
+>
+> * Prompt starters are only supported for one-on-one chat bots.
+
+To enable prompt starters, define the `commands` property in your bot's app manifest. Each command contains a `title` and `description`. The `title` is the prompt and the `description` describes what the users accomplish. When the user selects on a prompt starter, the `title` of the prompt is populated in the compose box. To define `commands` in your app manifest, you can either use **Developer Portal** or add them manually in the app manifest.
+
+# [Developer Portal](#tab/developer-portal)
+
+To create prompt starters using Developer Portal:
+
+1. Open Teams and select **Apps** from the left pane. In the **Apps** page, search for **Developer Portal**, and then select **Open**.
+
+ :::image type="content" source="~/assets/images/tdp/add-dev-portal.png" alt-text="Screenshot shows how to add Developer Portal in Teams client.":::
+
+1. In **Developer Portal**, select the **Apps** tab. If you don't have an existing app package, you can create or import an existing app. For more information, see [Developer Portal for Teams](~/concepts/build-and-test/teams-developer-portal.md).
+
+1. Select **Apps** tab, select **App features** from the left pane, and then select **Bots**.
+
+1. Under **Commands**, select **Add a command**.
+
+ :::image type="content" source="~/assets/images/tdp/add-a-bot-command.png" alt-text="Screenshot shows how to add a command for your bot in Developer Portal.":::
+
+1. Enter the values for the following fields:
+
+ * **Command**: Appears as the prompt for your bot.
+ * **Description**: A brief explanation of the purpose of the command.
+
+1. Select the personal scope and then select **Add**. This defines where the command menu must appear.
+
+ :::image type="content" source="~/assets/images/tdp/bot-command.png" alt-text="Screenshot shows how to add a command, description, and scopes for your bot.":::
+
+# [Manually in the app manifest](#tab/manually-in-the-app-manifest)
+
+Another way to create a prompt starter is to create it directly in the app manifest file while developing your bot source code. To use this method, follow these points:
+
+* The `command` property supports up to 10 commands.
+* You can either create prompt starters that work in all scopes or create different prompt starters for each scope.
+
+#### Manifest example for prompt starters
+
+The manifest example code for prompt starters is as follows:
+
+```json
+{
+ Γï«
+ "bots":[
+ {
+ "botId":"[Microsoft App ID for your bot]",
+ "scopes": [
+ "personal"
+ ],
+ "commandLists":[
+ {
+ "scopes":[
+ "personal"
+ ],
+ "commands":[
+ {
+ "title":"Help",
+ "description":"Displays this help message"
+ },
+ {
+ "title":"Search Flights",
+ "description":"Search flights from Seattle to Phoenix May 2-5 departing after 3pm"
+ },
+ {
+ "title":"Search Hotels",
+ "description":"Search hotels in Portland tonight"
+ },
+ {
+ "title":"Best Time to Fly",
+ "description":"Best time to fly to London for a 5 day trip this summer"
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ ...
+}
+```
+++
+> [!NOTE]
+> If you remove any commands from your manifest, you must redeploy your app to implement the changes. In general, any changes to the manifest require you to redeploy your app.
+
+The following illustrates an example of prompt suggestions:
+
+# [Desktop](#tab/desktop)
++
+# [Mobile](#tab/mobile)
++++
+Prompt starters reappear in the **View Prompts** flyout above the compose box during a conversation and enables users to review the prompts while interacting with your bot.
++
+You must handle menu commands in your bot code as you handle any message from users. You can handle menu commands in your bot code by parsing out the **\@Mention** portion of the message text.
+
+## Handle `commands` in your bot
+
+Bots in a group or channel respond only when they're @mentioned in a message. Every message received by a bot when in a group or channel scope contains its name in the message text. Before handling the command being returned, your message parsing must handle the message received by a bot with its name.
+
+> [!NOTE]
+> Handle the commands in code, they are sent to your bot as a regular message. You must handle them as you would handle any other message from your users. The commands in code insert pre-configured text into the text box. The user must then send that text as they do for any other message.
+
+# [C#](#tab/dotnet)
+
+* [SDK reference](/dotnet/api/microsoft.bot.schema.activityextensions.removerecipientmention?view=botbuilder-dotnet-stable#microsoft-bot-schema-activityextensions-removerecipientmention(microsoft-bot-schema-imessageactivity)&preserve-view=true)
+
+* [Sample code reference](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/app-hello-world/csharp/Microsoft.Teams.Samples.HelloWorld.Web/Bots/MessageExtension.cs#L19)
+
+You can parse out the **\@Mention** portion of the message text using a static method provided with the Microsoft Bot Framework. It's a method of the `Activity` class named `RemoveRecipientMention`.
+
+The C# code to parse out the **\@Mention** portion of the message text is as follows:
+
+```csharp
+// Remove recipient mention text from Text property.
+// Use with caution because this function is altering the text on the Activity.
+var modifiedText = turnContext.Activity.RemoveRecipientMention();
+```
+
+# [JavaScript](#tab/javascript)
+
+* [SDK reference](/javascript/api/botbuilder-core/turncontext?view=botbuilder-ts-latest#botbuilder-core-turncontext-removementiontext&preserve-view=true)
+
+* [Sample code reference](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/bot-people-picker-adaptive-card/nodejs/bots/teamsBot.js#L21)
+
+You can parse out the **\@Mention** portion of the message text using a static method provided with the Bot Framework. It's a method of the `TurnContext` class named `removeMentionText`.
+
+The JavaScript code to parse out the **\@Mention** portion of the message text is as follows:
+
+```javascript
+// Remove mention text from Text property, this function is altering the text on the Activity.
+const modifiedText = TurnContext.removeMentionText(turnContext.activity, turnContext.activity.recipient.id);
+```
+
+# [Python](#tab/python)
+
+* [SDK reference](/python/api/botbuilder-core/botbuilder.core.turncontext?view=botbuilder-py-latest#botbuilder-core-turncontext-remove-recipient-mention&preserve-view=true)
+
+* [Sample code reference](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/bot-conversation/python/bots/teams_conversation_bot.py#L34)
+
+You can parse out the **@Mention** portion of the message text using a static method provided with the Bot Framework. It's a method of the `TurnContext` class named `remove_recipient_mention`.
+
+The Python code to parse out the **\@Mention** portion of the message text is as follows:
+
+```python
+# Remove recipient mention text from Text property, this function is altering the text on the Activity.
+modified_text = TurnContext.remove_recipient_mention(turn_context.activity)
+```
+
+* * *
+
+## Suggested actions
++
+## Code sample
+
+| **Sample name** | **Description** |**.NET** |**Node.js** |
+|--|--|-|
+| Prompt starters bot | This sample code describes the implementation of prompt starters for bot through `commands` property in your bot's app manifest. | [View](https://github.com/OfficeDev/Microsoft-Teams-Samples/tree/main/samples/bot-commands-menu/csharp) | [View](https://github.com/OfficeDev/Microsoft-Teams-Samples/tree/main/samples/bot-commands-menu/nodejs) |
+
+## See also
+
+* [Build bots for Teams](~/bots/what-are-bots.md)
+* [App manifest schema for Teams](~/resources/schem)
+* [Messages in bot conversations](~/bots/how-to/conversations/conversation-messages.md)
+* [Adaptive Cards for bot developers](/adaptive-cards/getting-started/bots)
+
platform Create A Bot Commands Menu https://github.com/MicrosoftDocs/msteams-docs/commits/main/msteams-platform/bots/how-to/create-a-bot-commands-menu.md
# Create a commands menu > [!NOTE]
-> It's recommended that you'd create a command bot by following the step-by-step guide to [Build command bot with JavaScript](../../sbs-gs-commandbot.yml) using the new generation development tool for Teams. For more information about Teams Toolkit, see [Teams Toolkit Overview for Visual Studio Code](../../toolkit/teams-toolkit-fundamentals.md) and [Teams Toolkit overview for Visual Studio](../../toolkit/teams-toolkit-overview-visual-studio.md).
-
+> WeΓÇÖve enhanced the command menu experience as prompt starters. We recommend you to refer to [prompt starters](~/bots/how-to/conversations/prompt-suggestions.md).
To define a set of core commands that your bot can respond to, you can add a command menu with a dropdown list of commands for your bot. The list of commands is presented to the users in the compose message area when they are in conversation with your bot. Select a command from the list to insert the command string into the compose message box and select **Send**.
To define a set of core commands that your bot can respond to, you can add a com
## Create a command menu for your bot
+> [!NOTE]
+> It's recommended that you'd create a command bot by following the step-by-step guide to [build command bot with JavaScript](../../sbs-gs-commandbot.yml) using the new generation development tool for Teams. For more information about Teams Toolkit, see [Teams Toolkit Overview for Visual Studio Code](../../toolkit/teams-toolkit-fundamentals.md) and [Teams Toolkit overview for Visual Studio](../../toolkit/teams-toolkit-overview-visual-studio.md).
++ Command menus are defined in your app manifest. You can either use **Developer Portal** to create them or add them manually in the app manifest. ### Create a command menu for your bot using Developer Portal
To create a command menu for your bot using Developer Portal:
1. Select the **Scope** check box and then select **Add**. This defines where the command menu must appear.
- :::image type="content" source="../../assets/images/tdp/bot-command.png" alt-text="Screenshot shows how to add a command, description and scopes for your bot.":::
+ :::image type="content" source="../../assets/images/tdp/bot-command.png" alt-text="Screenshot shows how to add a command, description, and scopes for your bot.":::
### Create a command menu for your bot by editing Manifest.json Another way to create a command menu is to create it directly in the manifest file while developing your bot source code. To use this method, follow these points:
-* Each menu supports up to ten commands.
+* Each menu supports up to 10 commands.
* Create a single command menu that works in all scopes. * Create a different command menu for each scope.
You must handle menu commands in your bot code as you handle any message from us
## Handle menu commands in your bot code
-Bots in a group or channel respond only when they are mentioned `@botname` in a message. Every message received by a bot when in a group or channel scope contains its name in the message text. Before handling the command being returned, your message parsing must handle the message received by a bot with its name.
+Bots in a group or channel respond only when they're mentioned `@botname` in a message. Every message received by a bot when in a group or channel scope contains its name in the message text. Before handling the command being returned, your message parsing must handle the message received by a bot with its name.
> [!NOTE] > To handle the commands in code, they are sent to your bot as a regular message. You must handle them as you would handle any other message from your users. The commands in code insert pre-configured text into the text box. The user must then send that text as they do for any other message.
Bots in a group or channel respond only when they are mentioned `@botname` in a
* [Sample code reference](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/app-hello-world/csharp/Microsoft.Teams.Samples.HelloWorld.Web/Bots/MessageExtension.cs#L19)
-You can parse out the **\@Mention** portion of the message text using a static method provided with the Microsoft Bot Framework. It is a method of the `Activity` class named `RemoveRecipientMention`.
+You can parse out the **\@Mention** portion of the message text using a static method provided with the Microsoft Bot Framework. It's a method of the `Activity` class named `RemoveRecipientMention`.
The C# code to parse out the **\@Mention** portion of the message text is as follows:
var modifiedText = turnContext.Activity.RemoveRecipientMention();
* [Sample code reference](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/bot-people-picker-adaptive-card/nodejs/bots/teamsBot.js#L21)
-You can parse out the **\@Mention** portion of the message text using a static method provided with the Bot Framework. It is a method of the `TurnContext` class named `removeMentionText`.
+You can parse out the **\@Mention** portion of the message text using a static method provided with the Bot Framework. It's a method of the `TurnContext` class named `removeMentionText`.
The JavaScript code to parse out the **\@Mention** portion of the message text is as follows:
const modifiedText = TurnContext.removeMentionText(turnContext.activity, turnCon
* [Sample code reference](https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/bot-conversation/python/bots/teams_conversation_bot.py#L34)
-You can parse out the **@Mention** portion of the message text using a static method provided with the Bot Framework. It is a method of the `TurnContext` class named `remove_recipient_mention`.
+You can parse out the **@Mention** portion of the message text using a static method provided with the Bot Framework. It's a method of the `TurnContext` class named `remove_recipient_mention`.
The Python code to parse out the **\@Mention** portion of the message text is as follows:
Following are the command menu best practices:
> [!NOTE] > If you remove any commands from your manifest, you must redeploy your app to implement the changes. In general, any changes to the manifest require you to redeploy your app. + ## Next step > [!div class="nextstepaction"]
platform Suggested Actions https://github.com/MicrosoftDocs/msteams-docs/commits/main/msteams-platform/includes/bots/suggested-actions.md
+Suggested actions help users with ideas of what to ask next, based on the previous response or conversation. Your bot should offer context-specific suggestions to the user, rather than generic or fixed ones. You can use your botΓÇÖs large language model (LLM) to generate up to three suggestions along with its responses. Then, you can extract these suggestions and present them as options for the user to choose.
+
+When a user selects a button, it remains visible and accessible on the rich cards. However, for suggested actions, the buttons are designed to disappear after selection to prevent the user from selecting stale options that may no longer be relevant.
+
+> [!NOTE]
+>
+> * `SuggestedActions` are only supported for one-on-one chat bots with both text based messages and Adaptive Cards.
+> * `SuggestedActions` aren't supported for chat bots with attachments for any conversation type.
+> * `imBack` is the only supported action type and Teams display up to three suggested actions.
+
+To add suggested actions to a message, specify a list of [card action](/azure/bot-service/rest-api/bot-framework-rest-connector-api-reference) objects that represent the buttons to be displayed to the user for the [`sugestedActions`](/dotnet/api/microsoft.bot.builder.messagefactory.suggestedactions) property of the [activity](/azure/bot-service/rest-api/bot-framework-rest-connector-api-reference) object.
+
+The following is an example to implement and experience suggested actions:
+
+``` json
+{
+ "type": "message",
+ "from": {
+ "id": "12345678",
+ "name": "sender's name"
+ },
+ "conversation": {
+ "id": "abcd1234",
+ "name": "conversation's name"
+ },
+ "recipient": {
+ "id": "1234abcd",
+ "name": "recipient's name"
+ },
+ "text": "What are the tasks for the day.",
+ "inputHint": "expectingInput",
+ "suggestedActions": {
+ "actions": [
+ {
+ "type": "imBack",
+ "title": "Create a new query identifying overdue tasks",
+ "value": "Create a new query identifying overdue tasks"
+ },
+ {
+ "type": "imBack",
+ "title": "Create a new work item for this feature",
+ "value": "Create a new work item for this feature"
+ }
+ ]
+ },
+ "replyToId": "5d5cdc723"
+}
+```
+The following illustrates an example of suggested actions:
+
+# [Desktop](#tab/desktop)
++
+# [Mobile](#tab/mobile)
+
platform Whats New https://github.com/MicrosoftDocs/msteams-docs/commits/main/msteams-platform/whats-new.md
Teams platform features that are available to all app developers.
**2024 October**
+* ***October 25, 2024***: [Introduced prompt suggestions for bots to create an engaging and insightful bot experience.](bots/how-to/conversations/prompt-suggestions.md)
* ***October 17, 2024***: [Introducing app manifest v1.19](./resources/schem) with copilotAgents, declarativeAgents, and defaultLanguageFile. * ***October 17, 2024***: [Localize your Copilot agents](/microsoft-365-copilot/extensibility/agents-are-apps#localizing-your-agent). * ***October 17, 2024***: [Build a personal tab with offline functionality](tabs/how-to/create-personal-tab.md#offline-tabs).