I want to implement the function that when user select tag from list which is shown in Input.ChoiceSet, it invokes handleTeamsMessagingExtensionSelectItem.
My current code is as below.
actionApp.ts
public async onInvokeActivity(context: any): Promise<any> {
console.log("context.activity.name is ", context.activity.name);
if (context.activity.name == "application/search") {
let searchQuery = context.activity.value.queryText;
////other code///
}
if (context.activity.name == "composeExtension/selectItem") {
console.log("select item is called");
return TeamsBot.createInvokeResponse(
await this.handleTeamsMessagingExtensionSelectItem(
context,
context.activity.value
)
);
}
return super.onInvokeActivity(context);
}
public async handleTeamsMessagingExtensionSelectItem(
context: TurnContext,
obj: any
): Promise<any> {
console.log("tag is choosed");
return {};
}
manifest.json
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.16/MicrosoftTeams.schema.json",
"manifestVersion": "1.16",
"version": "1.0.0",
"id": "${{TEAMS_APP_ID}}",
"packageName": "com.microsoft.teams.extension",
"developer": {
"name": "Teams App, Inc.",
"websiteUrl": "https://www.example.com",
"privacyUrl": "https://www.example.com/termofuse",
"termsOfUseUrl": "https://www.example.com/privacy"
},
"icons": {
"color": "color.png",
"outline": "outline.png"
},
"name": {
"short": "ms-extension${{APP_NAME_SUFFIX}}",
"full": "full name for ms-extension"
},
"description": {
"short": "short description of ms-extension",
"full": "full description of ms-extension"
},
"accentColor": "#FFFFFF",
"bots": [ {
"botId": "${{BOT_ID}}",
"scopes": ["personal", "team"],
"needsChannelSelector": false,
"isNotificationOnly": false,
"commandLists": [
{
"scopes": ["personal", "team"],
"commands": [
{
"title": "staticsearch",
"description": "To get static type ahead search Adaptive Card"
},
{
"title": "dynamicsearch",
"description": "To get dynamic type ahead search Adaptive Card"
}
]
}
]
}],
"composeExtensions": [
{
"botId": "${{BOT_ID}}",
"canUpdateConfiguration": true,
"commands": [
{
"id": "bookmarkMessage",
"type": "action",
"title": "bookmark this message",
"description": "bookmark this message",
"initialRun": false,
"fetchTask": true,
"context": [
"compose",
"message",
"commandBox"
]
},
{
"id": "tagsChoiceSet",
"type": "query",
"title": "Find tag",
"description": "",
"initialRun": false,
"fetchTask": true,
"context": [
"commandBox",
"message",
"compose"
],
"parameters": [
{
"name": "tagsChoiceSet",
"title": "Search keyword",
"description": "Search keyword",
"inputType": "choiceset"
}
]
}
]
}
],
"configurableTabs": [],
"staticTabs": [],
"permissions": [
"identity",
"messageTeamMembers"
],
"validDomains": [
"${{BOT_DOMAIN}}"
]
}
I read this and I assumed"composeExtension/selectItem"is the case when user choose tag from list, but it seems it's not.
Am I missing something?
handleTeamsMessagingExtensionSelectItem method works with Message extension search list item. Once you select any list item from ME, it will hit this method but it will not work with the list of Input.ChoiceSet.
You can refer this sample: https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/app-hello-world/nodejs/src/message-extension.js#L46