Issue with Config Popup Dialog When Installing Bot App on Teams

XDeveloper 0 Reputation points
2024-04-24T11:57:49.12+00:00

I am building a bot/message extension app using the Teams Toolkit in Typescript. I am trying to implement a configuration popup that users can enter an API key into, which I can then store in some storage.

I referred to this documentation - Bot configuration experience - Teams | Microsoft Learn

I have tried the following code:

async handleTeamsConfigFetch(_context, _configData) {

let response = {};

const adaptiveCard = CardFactory.adaptiveCard(this.adaptiveCardForContinue());

response = {

  config: {

    value: {

      card: adaptiveCard,

      height: 500,

      width: 600,

      title: "test card",

    },

    type: "continue",

  },

};

return response;

}

However, I am getting an error that reads: "Property 'responseType' is missing in type '{ config: { value: { card: Attachment; height: number; width: number; title: string; }; type: string; }; }' but required in type 'ConfigResponse'."

I modified the code to this:

async handleTeamsConfigFetch(_context: TurnContext, _configData) {

console.log(_configData, _context);

const responseType = "config" as const;

const adaptiveCard = CardFactory.adaptiveCard(this.adaptiveCardForContinue());

return {

  config: {

    task: {

      value: {

        card: adaptiveCard,

        height: 500,

        width: 600,

        title: "test card",

      },

    },

  },

  responseType: responseType,

};

}


But now I am getting an error that reads: "<BotError>Error when processing invoke response: Config or Config Type is missing in Bot Config response" in the console of my browser. I can't find out docs too.

Can anyone assist me with this issue?

Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
2,868 questions
{count} votes