Forum Discussion

usman9012's avatar
usman9012
Copper Contributor
Dec 27, 2021

How can open sign in dialog inside the ms team

 am trying to create custom app through bot framework i want to open sign in dialog box inside the ms teams but i don't know how can i do this every time when i click on link sign in page open in the browser. I am testing in emulator every time when i click on link it open in browser

 

welcome.json

 {
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.2",
"body": [
    {
        "type": "Container",
        "items": [
            {
                "type": "TextBlock",
                "text": "Hi! I'm Bot - welcome to our app for Microsoft Team!",
                "wrap": true,
                "weight": "Bolder"
            }
        ]
    },
    {
        "type": "Container",
        "items": [
            {
                "type": "TextBlock",
                "wrap": true,
                "weight": "Lighter",
                "text": "I'm here to help you manage your tickets with in teams."
            },
            {
                "type": "Container",
                "items": [
                    {
                        "type": "TextBlock",
                        "text": "Here's what can i do:"
                    },
                    {
                        "type": "TextBlock",
                        "text": "Create a new ticket.",
                        "wrap": true
                    }
                ]
            }
        ],
        "verticalContentAlignment": "Bottom"
    },
    {
        "type": "TextBlock",
        "text": "Post ticket related notifications to the team channel of your choice.",
        "wrap": true
    },
    {
        "type": "Container",
        "items": [
            {
                "type": "TextBlock",
                "text": "For more information, visit our [knowledge base article](https://example.com/blog/). If you're the help desk administrator, please link to start using Bot for Microsoft Teams, [Book a demo](https://example.com/) if you don't have account",
                "wrap": true
            }
        ]
    },
    {
        "type": "Container",
        "items": [
            {
                "type": "ActionSet",
                "actions": [
                    {
                        "type": "Action.OpenUrl",
                        "title": "Link",
                        "url": "https://ngrok.io/sign_in"
                    }
                ]
            }
        ]
    }
 ]
}

bot.ts 

this.onMembersAdded(async (context, next) => {
  const welcomeCard: Attachment = CardFactory.adaptiveCard(WelcomeCard);
  const membersAdded = context.activity.membersAdded;
  for (const member of membersAdded) {
    if (member.id !== context.activity.recipient.id) {
      // If we are in Microsoft Teams
      if (context.activity.channelId === 'msteams') {
        // Send a message with an @Mention
        await this._messageWithMention(context, member, welcomeCard);
      } else {
        await context.sendActivity({ attachments: [welcomeCard] });
      }
    }
  }
  // By calling next() you ensure that the next BotHandler is run.
  await next();
});

Share

Resources