Forum Discussion

XDeveloper29's avatar
XDeveloper29
Copper Contributor
Apr 24, 2024

Issue on PopUp Dialog on installing bot app on teams

I'm building a bot/message extension app using Teams Toolkit in Typescript. I want the user to get a config popup which user can enter the API key and I can store the key in some storage.

 

I refer to this doc - Bot configuration experience - Teams | Microsoft Learn

I have tried this 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;
  }

 

 

 

But I'm getting error - Property 'responseType' is missing in type '{ config: { value: { card: Attachment; height: number; width: number; title: string; }; type: string; }; }' but required in type 'ConfigResponse'.

 

So, I modified it like this

async handleTeamsConfigFetch(_context: TurnContext, _configData) {
  console.log(_configData, _context);
  const responseType = "config" as const;
  const adaptiveCard = CardFactory.adaptiveCard(
    this.createAdaptiveCardWithText("test")
  );
  return {
    config: {
      task: {
        value: {
          card: adaptiveCard,
          height: 500,
          width: 600,
          title: "test card",
        },
      },
    },
    responseType: responseType,
  };
}

 

 

 

 

Now I'm getting error <BotError>Error when processing invoke response: Config or Config Type is missing in Bot Config response in the console of the browser.

 

Please help on this.

Resources