OfficeDev / microsoft-teams-library-js

JavaScript library for use by Microsoft Teams apps
https://docs.microsoft.com/microsoftteams/platform/
Other
427 stars 195 forks source link

Query Message Extension with multiple parameters not available in commandBox context #2394

Open onmomo opened 3 months ago

onmomo commented 3 months ago

We implemented bot based query message extensions for CoPilot. During the process, of adding more than one parameter to the query extension we noticed that our query message extension is no longer available in the commandBox scope. It should be shown as Questions in the commandBox While CoPilot is now fully supported by having multiple search parameters for the query message extension, it seems that our users can no longer use the query extension in the commandBox. Removing all parameters but one from the query message extension, resolves the issues but breaks it obviously for CoPilot. So it seems like introducing CoPilot support causes a regression in the commandBox context by introducing multiple parameters for query message extensions.

Questions msg extension is shown if just a single parameter was added

starmind_single_parameter_query_extension

Questions msg extension is missing once multiple parameters were added

starmind_multi_parameter_query_extension

This can easily be reproduced by adding multiple parameters to the query command in the manifest.json for example, the first command, InventorySearch won't be shown in the commandBox whereas discountSearch command would still be shown

"commands": [
                {
                    "id": "inventorySearch",
                    "context": [
                        "compose",
                        "commandBox"
                    ],
                    "description": "Search products by name, category, inventory status, supplier location, stock level",
                    "title": "Product inventory",
                    "type": "query",
                    "parameters": [
                        {
                            "name": "productName",
                            "title": "Product name",
                            "description": "Enter a product name here",
                            "inputType": "text"
                        },
                        {
                            "name": "categoryName",
                            "title": "Category name",
                            "description": "Enter the category of the product",
                            "inputType": "text"
                        },
                        {
                            "name": "inventoryStatus",
                            "title": "Inventory status",
                            "description": "Enter what status of the product inventory. Possible values are 'in stock', 'low stock', 'on order', or 'out of stock'",
                            "inputType": "text"
                        },
                        {
                            "name": "supplierCity",
                            "title": "Supplier city",
                            "description": "Enter the supplier city of product",
                            "inputType": "text"
                        },
                        {
                            "name": "stockQuery",
                            "title": "Stock level",
                            "description": "Enter a range of integers such as 0-42 or 100- (for >100 items). Only use if you need an exact numeric range.",
                            "inputType": "text"
                        }
                    ]
                },
                {
                    "id": "discountSearch",
                    "context": [
                        "compose",
                        "commandBox"
                    ],
                    "description": "Search for discounted products by category",
                    "title": "Discounts",
                    "type": "query",
                    "parameters": [
                        {
                            "name": "categoryName",
                            "title": "Category name",
                            "description": "Enter the category to find discounted products",
                            "inputType": "text"
                        }
                    ]
                },
                {
                    "id": "revenueSearch",
                    "context": [
                        "compose",
                        "commandBox"
                    ],
                    "description": "Find products based on their revenue/period",
                    "title": "Revenue",
                    "type": "query",
                    "parameters": [
                        {
                            "name": "revenueRange",
                            "title": "Revenue range",
                            "description": "Enter 'high' or 'low' or enter a range of integers such as 0-10000 or 5000- using this exact format",
                            "inputType": "text"
                        }
                    ]
                }
            ]
Dinesh-MSFT commented 3 months ago

Hi @onmomo - Thanks for raising the query. It appears there is a known issue with the commandBox scope when multiple parameters are added to a query message extension in Microsoft Teams. In the meantime, using a single parameter for the query message extension will ensure it remains available in the commandBox scope. For more detailed guidance and updates on this issue, please refer to the official Microsoft documentation on Build Bot-based Message Extensions - Teams. To help you better, could you please provide the manifest file and any relevant screenshots to investigate and resolve it more efficiently.

onmomo commented 3 months ago

Hi @onmomo - Thanks for raising the query. It appears there is a known issue with the commandBox scope when multiple parameters are added to a query message extension in Microsoft Teams. In the meantime, using a single parameter for the query message extension will ensure it remains available in the commandBox scope. For more detailed guidance and updates on this issue, please refer to the official Microsoft documentation on Build Bot-based Message Extensions - Teams. To help you better, could you please provide the manifest file and any relevant screenshots to investigate and resolve it more efficiently.

@Dinesh-MSFT thanks for coming back to me. We are aware that using a single parameter works around this but in order to support Copilot, search message extensions need to support at least three parameters as documented in the source I provided, which makes this issue a regression. Please resolve. The provided manifest and screenshots should be enough to reproduce this but as it seems this is a known issue anyways? When do you plan to resolve this? It will most likely be highlighted during app validation by the teamssub team.

catmanjan commented 3 months ago

I thought Microsoft was dropping all support for commandBox bot integrations?

Dinesh-MSFT commented 2 months ago

Hi @catmanjan, Sorry for the delay in the response. We are checking this issue internally with engineering team and let know the update.