botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

Type ahead search does not work from Task Module

Open harkiratsaluja opened this issue 3 years ago • 10 comments

Version

Adaptive Card - 1.5 "botbuilder": "~4.14.0",

Describe the bug

I need to implement a scenario where type ahead search makes a call to my remote api and fills in the choice list. This works fine the if adaptive card is sent directly in the chat. But this not work inside if the adaptive card is sent in the task module.

To Reproduce

Steps to reproduce the behavior:

Following is the message which is sent for adaptive card

const card = CardFactory.adaptiveCard({
    type: 'AdaptiveCard',
    body: [
      {
        type: 'RichTextBlock',
        inlines: [
          {
            type: 'TextRun',
            text: 'Test',
            weight: 'bolder',
          },
          {
            type: 'TextRun',
            text: 'Test',
          }
        ],
        separator: parseInt(index) === 0,
        spacing: parseInt(index) === 0 ? 'extraLarge': 'default',
      },
     {
        title: 'Update',
        type: 'Action.Submit',
        data: {
          msteams: {
            type: 'task/fetch'
          },
          id: 'Upate Id',
          buttonText: 'Update',
        }
      }
    ],
    $schema: 'http://adaptivecards.io/schemas/adaptive-card.json',
    version: '1.5',
  })

Following is card which is sent in task module

const card = CardFactory.adaptiveCard({
    $schema: 'http://adaptivecards.io/schemas/adaptive-card.json',
    version: '1.5',
    type: 'AdaptiveCard',
    body: [
      {
          "columns": [
          {
              "width": "stretch",
              "items": [
              {
                  "choices": [
                  {
                      "title": "Static Option 1",
                      "value": "static_option_1"
                  },
                  {
                      "title": "Static Option 2",
                      "value": "static_option_2"
                  },
                  {
                      "title": "Static Option 3",
                      "value": "static_option_3"
                  }
                  ],
                  "isMultiSelect": false,
                  "style": "filtered",
                  "choices.data": {
                  "type": "Data.Query",
                  "dataset": "npmpackages",
                  "testkey": "harkirat"
                  },
                  "id": "choiceselect",
                  "type": "Input.ChoiceSet"
              }
              ],
              "type": "Column"
          }
          ],
          "type": "ColumnSet"
      }
  ],
    actions: [
      {
        type: 'Action.Submit',
        title: 'Save',
        data: {
          privateMeta,
          replyToId
        }
      }
    ]
  });

Following is the onActivityInvoke code:-

  async onInvokeActivity(context: TurnContext): Promise<InvokeResponse<any>> {
    if (context.activity.name === 'task/fetch') {
      const result = await this.handleTeamsTaskModuleFetch(context, {
        replyToId: context.activity.replyToId,
        data: context.activity.value.data
      });
      return {
        status: 200,
        body: result
      }
    }
    if (context.activity.name == 'application/search') {
      const successResult = {
        status: 200,
        body: {
          "type": "application/vnd.microsoft.search.searchResponse",
          "value": {
            "results": [
              {
                "value": "FluentAssertions",
                "title": "A very extensive set of extension methods"
              },
              {
                "value": "FluentUI",
                "title": "Fluent UI Library"
              }
            ]
          }
        }
      }

      return successResult;
    }
  }

Note that the activityInvoke function is not called when I enter the search text in my input box. However, if I send this card directly i.e without task module and directly in chat it works just fine.

Expected behavior

Type ahead search should work from Task Module

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

Tracking Status

Dotnet SDK TODO

  • [ ] PR
  • [ ] Merged

Javascript SDK TODO

  • [ ] PR
  • [ ] Merged

Python SDK TODO

  • [ ] PR
  • [ ] Merged

Java SDK TODO

  • [ ] PR
  • [ ] Merged

Samples TODO

  • [ ] PR
  • [ ] Merged

Docs TODO

  • [ ] PR
  • [ ] Merged

Tools TODO

  • [ ] PR
  • [ ] Merged

harkiratsaluja avatar Mar 09 '22 17:03 harkiratsaluja

@harkiratsaluja, I'll be attempting a repro of this and will come back with a result and any questions.

stevkan avatar Mar 10 '22 18:03 stevkan

@stevkan Adding to the above, I tried to check the error message in ms teams web and it gives me error 504: Bot is not installed on type ahead search from task module.

harkiratsaluja avatar Mar 11 '22 05:03 harkiratsaluja

Hey @stevkan just wanted to check if you need any help from my end in debugging or reproducing the issue?

harkiratsaluja avatar Mar 14 '22 07:03 harkiratsaluja

@harkiratsaluja, I see that there is a duplicate post you had created in Stack Overflow and that a Teams rep responded to you. I reached out to that individual to see if any information had been collected. They advised they are still looking into it and will get back to me/us when they know more.

stevkan avatar Mar 15 '22 15:03 stevkan

@stevkan, Yes I had created an issue there also as I am not sure if this a bug or a feature which is missing. Looking forward to hear from you/them soon.

harkiratsaluja avatar Mar 16 '22 06:03 harkiratsaluja

hey @stevkan just wanted to check if there has been any updates on this?

harkiratsaluja avatar Mar 21 '22 05:03 harkiratsaluja

Hi @harkiratsaluja

Thank you for reporting this. I see there is now a response from Meghana-MSFT on StackOverflow:

The engineering team is working on the fix for this issue. We do not have any ETA to share.Stack Overflow Comment

EricDahlvang avatar Mar 22 '22 19:03 EricDahlvang

Hi @EricDahlvang this is still not working. I still get the same error.

0.2-angular-jquery.min-92954a0.js:114 2022-05-18T16:22:00.864Z [BotCardService:executeSearchInvoke()] invoke failed: bot not installed
0.2-angular-jquery.min-92954a0.js:114 {statusCode: 504, message: 'App is not installed'} undefined

harkiratsaluja avatar May 18 '22 16:05 harkiratsaluja

Mine is having the same issue using the official example: https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/bot-type-ahead-search-adaptive-cards/nodejs/appPackage/manifest.json

[BotCardService:executeSearchInvoke()] invoke failed: bot not installed

johnmiroki avatar Jan 18 '23 10:01 johnmiroki

@EricDahlvang Hi Eric, your comment would be appreciated as we are having the same trouble.

johnmiroki avatar Jan 19 '23 05:01 johnmiroki