'Type ahead search does not work from Task Module

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.

Steps

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.

Can someone please help me understand if I am missing something, is this a bug or the feature itself is not supported?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source