Action commands
Action commands allow you to present your users with a modal pop-up called a dialog in Teams. The dialog collects or displays information, processes the interaction, and sends the information back to Teams compose box.
Action command invocation locations
There are three different areas action commands can be invoked from:
- Compose Area
- Compose Box
- Message
Compose Area and Box
Message action command
See the Invoke Locations guide to learn more about the different entry points for action commands.
Setting up your Teams app manifest
To use action commands you have define them in the Teams app manifest. Here is an example:
"composeExtensions": [
{
"botId": "${{BOT_ID}}",
"commands": [
{
"id": "createCard",
"type": "action",
"context": [
"compose",
"commandBox"
],
"description": "Command to run action to create a card from the compose box.",
"title": "Create Card",
"parameters": [
{
"name": "title",
"title": "Card title",
"description": "Title for the card",
"inputType": "text"
},
{
"name": "subTitle",
"title": "Subtitle",
"description": "Subtitle for the card",
"inputType": "text"
},
{
"name": "text",
"title": "Text",
"description": "Text for the card",
"inputType": "textarea"
}
]
},
{
"id": "getMessageDetails",
"type": "action",
"context": [
"message"
],
"description": "Command to run action on message context.",
"title": "Get Message Details"
},
{
"id": "fetchConversationMembers",
"description": "Fetch the conversation members",
"title": "Fetch Conversation Members",
"type": "action",
"fetchTask": true,
"context": [
"compose"
]
},
]
}
]
Here we are defining three different commands:
createCard
- that can be invoked from either thecompose
orcommandBox
areas. Upon invocation a dialog will popup asking the user to fill thetitle
,subTitle
, andtext
.
getMessageDetails
- It is invoked from themessage
overflow menu. Upon invocation the message payload will be sent to the app which will then return the details likecreatedDate
...etc.
fetchConversationMembers
- It is invoked from thecompose
area. Upon invocation the app will return an adaptive card in the form of a dialog with the conversation roster.
Handle submission
Handle submission when the createCard
or getMessageDetails
actions commands are invoked.
createCard()
function
createMessageDetailsCard()
function
Handle opening adaptive card dialog
Handle opening adaptive card dialog when the fetchConversationMembers
command is invoked.
createConversationMembersCard()
function