microsoft / botbuilder-dotnet

Welcome to the Bot Framework SDK for .NET repository, which is the home for the libraries and packages that enable developers to build sophisticated bot applications using .NET.
https://github.com/Microsoft/botframework
MIT License
865 stars 480 forks source link

Parameter MessagingExtensionQuery always returns just first CommandId from manifest #6465

Open harald-thoenig opened 1 year ago

harald-thoenig commented 1 year ago

I'm using Microsoft Bot Framework V4 SDK to create a messaging extension bot.

I created two commands (searchQuery, processQuery). I would like to call up a configuration page for each command. The problem is that the MessagingExtensionQuery parameter in the OnTeamsMessagingExtensionConfigurationQuerySettingUrlAsync event always returns just the first command Id, I entered in the manifest.

I would have expected that when I click on the 3 dots to open the configuration page, the respective ID of the command would be passed to the event.

Messaging extension bot ConfigurationPage Manifest

Hope you can help. regads

dmvtech commented 1 year ago

I am taking a look at this.

DridiFathi commented 1 year ago

@dmvtech any update on this?

dmvtech commented 1 year ago

Hi @harald-thoenig @DridiFathi

Apologies for the delay. We are still investigating.

dmvtech commented 1 year ago

Hi @harald-thoenig

To clarify the behavior a bit. When you say:

when I click on the 3 dots to open the configuration page

Do you mean; when you click on the three dots? Or when you select settings: image

If you could please share more information and specifics on how exactly you set up the configuration/configuration page.

dmvtech commented 1 year ago

@ramfattah

harald-thoenig commented 1 year ago

Hi @ramfattah If I select settings the event OnTeamsMessagingExtensionConfigurationQuerySettingUrlAsync will be triggered. In this event I get the command Id. But this command Id is always the first command Id from manifest. But I like to know on which command the user has selected the settings, then I could provide users different configuration pages per command Id. I did the implementation of the configuration page exactly as it is described in the git sample "https://github.com/microsoft/BotBuilder-Samples/tree/main/samples/csharp_dotnetcore/50.teams-messaging-extensions-search/Bots)".

InfinytRam commented 1 year ago

Thanks @harald-thoenig,

I was able to reproduce this issue using C# bot sample 52.teams-messaging-extensions-search-auth-config.

Sharing the steps to reproduce:

  1. Clone sample 52.teams-messaging-extensions-search-auth-config into your local environment.
  2. In file manifest.json, replace the commands section with the following:

    
      "name": {
        "short": "Messaging Extension Auth",
        "full": "ME Auth for Search, Action and link unfurling"
      },
      "description": {
        "short": "ME Authentication for Search, Action and Link unfurling",
        "full": "ME Authentication sample code for all authentication merged"
      },
      "accentColor": "#FFFFFF",
      "composeExtensions": [
        {
          "botId": "<<YOUR-MICROSOFT-APP-ID>>",
          "canUpdateConfiguration": true,
    +      "commands": [
    +        {
    +          "id": "searchQuery",
    +         "type": "query",
    +          "title": "Search",
    +          "description": "Perform a search",
    +          "initialRun": false,
    +          "fetchTask": false,
    +          "context": [
    +            "commandBox",
    +            "compose",
    +            "message"
    +          ],
    +          "parameters": [
    +            {
    +              "name": "searchQuery",
    +              "title": "Search",
    +              "description": "Your search query",
    +              "inputType": "text"
    +            }
    +          ]
    +        },
    +        {
    +          "id": "processQuery",
    +          "type": "query",
    +          "title": "Tasks",
    +          "description": "Task lists",
    +          "initialRun": true,
    +          "fetchTask": false,
    +          "context": [
    +           "commandBox",
    +            "compose",
    +            "message"
    +          ],
    +          "parameters": [
    +            {
    +              "name": "processQuery",
    +              "title": "Process",
    +              "description": "ProcessList",
    +              "inputType": "text"
    +            }
    +          ]
    +        },
    +        {
    +          "id": "SignOutCommand",
    +          "type": "action",
    +          "title": "Sign Out",
    +          "description": "Sign out from authenticated services.",
    +          "initialRun": false,
    +          "fetchTask": true,
    +          "context": [
    +            "commandBox",
    +            "compose"
    +          ],
    +          "parameters": [
    +            {
    +              "name": "param",
    +              "title": "param",
    +              "description": ""
    +            }
    +          ]
    +        }
    +      ],
          "messageHandlers": [
            {
              "type": "link",
              "value": {
                "domains": [
                  "*.botframework.com"
                ]
              }
            }
          ]
        }
      ],
      "permissions": [
        "identity"
      ],
      "validDomains": [
        "*.githubusercontent.com",
        "*.ngrok.io",
        "*.botframework.com"
      ]
    }
    
    • Notice we have 3 command ids: searchQuery, processQuery, and SignOutCommand
  3. Install and Run the bot in Teams channel. From my end, I set up ngrok tunneling solution.
  4. In the bot sample code, put break point on method OnTeamsMessagingExtensionConfigurationQuerySettingUrlAsync
  5. In Teams, at the top nav search bar, @ mention the Messaging Extension Auth app.
  6. Select Tasks, and at the bottom right of the drop down, click the three dots ... 1055ebf9eedf527b166e791490ef0fef
  7. Notice the MessagingExtensionQuery query parameter in method OnTeamsMessagingExtensionConfigurationQuerySettingUrlAsync always returns the first command Id searchQuery instead of processQuery. image
InfinytRam commented 1 year ago

Hey @JuanAr, we are reaching out to see if there is status update on this.

Thanks.

JuanAr commented 1 year ago

Hey @JuanAr, we are reaching out to see if there is status update on this.

Thanks.

Hi @ramfattah, this issue is on our backlog. We'll be tackling it next week. Thanks.

ceciliaavila commented 1 year ago

We reproduced the issue and found that it's the MSTeams client the one sending the wrong commandId in the property value of the activity (documentation here). We consider this issue can be closed as there's nothing to fix on the SDK.

InfinytRam commented 1 year ago

Thank you @ceciliaavila. Closing as this issue is not related to Bot Framework SDK.

tracyboehrer commented 1 year ago

Reopening, will notify Teams during sync meetings.