अपना फ़ीडबैक साझा करें:
हम Microsoft Teams डेवलपर दस्तावेज़ों पर आपकी प्रतिक्रिया चाहते हैं। कृपया हमारे छोटे तीन-प्रश्न सर्वेक्षण का उत्तर दें।सर्वेक्षण करें
यह ब्राउज़र अब समर्थित नहीं है.
नवीनतम सुविधाओं, सुरक्षा अपडेट और तकनीकी सहायता का लाभ लेने के लिए Microsoft Edge में अपग्रेड करें.
Cards used by bots and message extensions in Microsoft Teams support the following activity CardAction types:
नोट
The CardAction actions differ from potentialActions for connector cards for Microsoft 365 Groups when used from connectors.
Type
Action
openUrl
Opens a URL in the default browser.
messageBack
Sends a message and payload to the bot from the user who selected the button or tapped the card. Sends a separate message to the chat stream.
imBack
Sends a message to the bot from the user who selected the button or tapped the card. This message from user to bot is visible to all conversation participants.
invoke
Sends a message and payload to the bot from the user who selected the button or tapped the card. This message isn't visible.
signin
Initiates OAuth flow, allowing bots to connect with secure services.
नोट
Teams does not support CardAction types not listed in the previous table.
Teams does not support the potentialActions property.
Card actions are different than suggested actions in Bot Framework or Azure Bot Service.
If you are using a card action as part of a message extension, the actions do not work until the card is submitted to the channel. The actions do not work while the card is in the compose message box.
Action type openUrl
openUrl action type specifies a URL to launch in the default browser.
नोट
Your bot doesn't receive any notice on which button was selected.
URLs don't support machine names that include numbers. For example, a hostname such as userhostname123 isn't supported.
With openUrl, you can create an action with the following properties:
Property
Description
title
Appears as the button label.
value
This field must contain a full and properly formed URL.
With messageBack, you can create a fully customized action with the following properties:
Property
Description
title
Appears as the button label.
displayText
Optional. Used by the user in the chat stream when the action is performed. This text isn't sent to your bot.
value
Sent to your bot when the action is performed. You can encode context for the action, such as unique identifiers or a JSON object.
text
Sent to your bot when the action is performed. Use this property to simplify bot development. Your code can check a single top-level property to dispatch bot logic.
The flexibility of messageBack means that your code can't leave a visible user message in the history simply by not using displayText.
The following code shows an example of messageBack action type in JSON:
JSON
{
"buttons": [
{
"type": "messageBack",
"title": "My MessageBack button",
"displayText": "I clicked this button",
"text": "User just clicked the MessageBack button",
"value": "{\"property\": \"propertyValue\" }"
}
]
}
The value property can be either a serialized JSON string or a JSON object.
The following code shows an example of messageBack action type in C#:
C#
var button = new CardAction()
{
Type = ActionTypes.MessageBack,
Title = "My MessageBack button",
DisplayText = "I clicked this button",
Text = "User just clicked the MessageBack button",
Value = "{\"property\": \"propertyValue\" }"
};
The following code shows an example of messageBack action type in JavaScript:
JavaScript
CardFactory.actions([
{
type: 'messageBack',
title: "My MessageBack button",
displayText: "I clicked this button",
text: "User just clicked the MessageBack button",
value: {property: "propertyValue" }
}])
Inbound message example
replyToId contains the ID of the message that the card action came from. Use it if you want to update the message.
The following code shows an example of inbound message:
The imBack action triggers a return message to your bot, as if the user typed it in a normal chat message. Your user and all other users in a channel can see the button response.
With imBack, you can create an action with the following properties:
Property
Description
title
Appears as the button label.
value
This field must contain the text string used in the chat and therefore sent back to the bot. This is the message text you process in your bot to perform the desired logic.
नोट
The value field is a simple string. There is no support for formatting or hidden characters.
Action.Execute: Gathers the input fields, merges with optional data field, and sends an event to the client.
Action.ResetInputs: Resets the values of the inputs in an Adaptive Card.
Action.Submit
Action.Submit type is used to gather the input, combine the data properties, and send an event to the bot. When a user selects the submit action, Teams sends a message activity to the bot, which includes the user's input in key-value pairs for all input fields and hidden data that is defined in the card payload.
In the Adaptive Card schema, the data property for Action.Submit is either a string or an object. A submit action behaves differently for each data property:
string: A string submit action automatically sends a message from the user to the bot and is visible in the conversation history.
object: An object submit action automatically sends an invisible message from the user to the bot that contains hidden data. An object submit action populates the activity’s value property while the text property is empty.
Action.Submit is equivalent to the Bot Framework actions. You can also modify the Adaptive Card Action.Submit payload to support existing Bot Framework actions using an msteams property in the data object of Action.Submit. When you define the msteams property under data, the Teams client defines the behavior of Action.Submit. If the msteams property isn't defined in the schema, Action.Submit works like a regular Bot Framework invoke action, where; the submit action triggers an invoke call to the bot and the bot receives the payload with all the input values defined in the input fields.
नोट
The bot doesn’t receive user input unless the user submits their actions in the Adaptive Card through a button, such as Save or Submit. For example, the bot doesn't consider user actions, such as selecting an option from multiple choices or filling out fields in a form, as inputs unless the user submits them.
Adding msteams to data with a Bot Framework action doesn't work with an Adaptive Card dialog.
Primary or destructive ActionStyle isn't supported in Teams.
Your app has five seconds to respond to the invoke message.
Example
The following is an example of an Action.Submit card payload:
The payload consists of a text input field "id": "text-1" and hidden data payload "hiddenKey": 123.45.
The following is an example of the incoming activity to a bot when user types something in the input field and selects Submit. The value attribute includes the user's input in the text-1 property and a hidden data payload in the hiddenKey property:
You can use the conditionallyEnabled property to disable action buttons until the user changes the value of at least one of the required inputs. This property can only be used with Action.Submit and Action.Execute actions. For a conditionally enabled button, if the isEnabled property is set to false, actions are disabled regardless of the input.
Here's how the conditionallyEnabled property is defined:
Property
Type
Required
Description
conditionallyEnabled
Boolean
✔️
Controls if the action is enabled only if at least one required input has been filled by the user.
The following card payload shows a conditionally enabled button:
You can build form completion feedback using an Adaptive Card. Form completion message appears in Adaptive Cards while sending a response to the bot. The message can be of two types, error or success:
Error: When a response sent to the bot is unsuccessful, Something went wrong, Try again message appears. The error occurs due to various reasons, such as:
Too many requests
Multiple concurrent operations on the same conversation
Service dependency issue
Gateway Timeout
Success: When a response sent to the bot is successful, Your response was sent to the app message appears.
You can select Close or switch chat to dismiss the message.
If you don't want to display the success message, set the attribute hide to true in the msTeamsfeedback property. Following is an example:
To include a messageBack action with an Adaptive Card, include the following details in the msteams object:
नोट
You can include additional hidden properties in the data object, if required.
Property
Description
type
Set to messageBack.
displayText
Optional. Used by the user in the chat stream when the action is performed. This text isn't sent to your bot.
value
Sent to your bot when the action is performed. You can encode context for the action, such as unique identifiers or a JSON object.
text
Sent to your bot when the action is performed. Use this property to simplify bot development. Your code can check a single top-level property to dispatch bot logic.
The following code shows an example of Adaptive Cards with messageBack action:
JSON
{
"type": "Action.Submit",
"title": "Click me for messageBack",
"data": {
"msteams": {
"type": "messageBack",
"displayText": "I clicked this button",
"text": "text to bots",
"value": "{\"bfKey\": \"bfVal\", \"conflictKey\": \"from value\"}"
}
}
}
Adaptive Cards with imBack action
To include an imBack action with an Adaptive Card, include the following details in the msteams object:
नोट
The value field is a simple string that doesn’t support formatting or hidden characters.
Property
Description
type
Set to imBack.
value
String that needs to be echoed back in the chat.
The following code shows an example of Adaptive Cards with imBack action:
JSON
{
"type": "Action.Submit",
"title": "Click me for imBack",
"data": {
"msteams": {
"type": "imBack",
"value": "Text to reply in chat"
}
}
}
Adaptive Cards with sign-in action
To include a signin action with an Adaptive Card, include the following details in the msteams object:
नोट
You can include additional hidden properties in the data object, if required.
Property
Description
type
Set to signin.
value
Set to the URL where you want to redirect.
The following code shows an example of Adaptive Cards with signin action:
JSON
{
"type": "Action.Submit",
"title": "Click me for signin",
"data": {
"msteams": {
"type": "signin",
"value": "https://signin.com"
}
}
}
Adaptive Cards with invoke action
To include an invoke action with an Adaptive Card, include the following details in the msteams object:
नोट
You can include additional hidden properties in the data object, if required.
Property
Description
type
Set to task/fetch.
data
Set the value.
The following code shows an example of Adaptive Cards with invoke action:
Introduces all card types including thumbnail, audio, media etc. Builds on Welcoming user + multi-prompt bot by presenting a card with buttons in welcome message that route to appropriate dialog.
इस सामग्री का स्रोत GitHub पर पाया जा सकता है, जहाँ आप समस्याएँ बना और समीक्षा भी कर सकते हैं और अनुरोध खींच सकते हैं. अधिक जानकारी के लिए, हमारे योगदानकर्ता गाइड देखें.
Platform Docs प्रतिक्रिया
Platform Docs एक ओपन सोर्स प्रोजेक्ट है. प्रतिक्रिया प्रदान करने के लिए लिंक का चयन करें:
Adaptive Cards are platform-agnostic snippets of UI, authored in JSON, that apps and services can openly exchange. When delivered to a specific app, the JSON is transformed into native UI that automatically adapts to its surroundings. It helps design and integrate light-weight UI for all major platforms and frameworks. In this module, you'll learn how to create engaging messages with Adaptive Cards to create Outlook Actionable Messages and conversations in Microsoft Teams.
Learn about container layouts in Adaptive Cards, including Layout.Flow, Layout.AreaGrid, and Layout.Stack, to create responsive and flexible card designs.
Learn about Sequential Workflows for Adaptive Cards using Universal Actions with code samples, invoke request received on bot side, and Adaptive Card response.
Learn about card text formatting with Markdown and HTML, how to design responsive Adaptive Cards, and other elements to create actionable Adaptive Cards.