This is reference for anyone who needs it in order to create a message extension (previously called compose extension) in MS Teams. If you stray outside of the TS/C# world, it’s a pain to find all of this out.
This reference was working as of 24 AUG 2023. It details making a message extension that can search and has a settings page.
Prereqs: you’ll need a Bot, created in dev.teams.microsoft.com > Tools > Bot Management.
manifest.json
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.16/MicrosoftTeams.schema.json",
"manifestVersion": "1.16",
"composeExtensions":
[
{
"botId": "abcd1235-abcd-1234-abcd-abcd1234abcd",
"canUpdateConfiguration": true,
"commands":
[
{
"id": "search",
"type": "query",
"title": "Search",
"description": "Search...",
"initialRun": true,
"fetchTask": false,
"context":
[
"commandBox",
"compose"
],
"parameters":
[
{
"name": "q",
"title": "Search term",
"description": "e.g. jobs, cars, holidays...",
"inputType": "text"
}
]
}
],
"messageHandlers":
[
{
"type": "link",
"value":
{
"domains":
[
"example.com"
]
}
}
]
}
],
"validDomains":
[
"example.com"
],
}
In your app controller that handles POST requests from the Bot, you’ll receive the following types of payloads:
# Request
{
"type": "invoke",
"name": "composeExtension/querySettingUrl"
}
# Response
{
"composeExtension": {
"type": "config"
"suggestedActions": {
"actions": [
{
"type": "openApp",
"title": "Settings",
"value": "https://example.com/settings"
},
],
},
}
}