Search code examples
botframeworkmicrosoft-teams

CallingBotSample does not throw welcome Text with Adaptive Card


I am trying to run this sample, and not having much luck :

https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/bot-calling-meeting/csharp/

I created an App on Azure and then used https://dev.botframework.com/bots/new to create a BOT and link it to this App and enabled Calling and configured an ngrok URL so that I can run the project locally under Visual Studio.

I have configured the App and the sample as explained in the readme and sideloaded it into teams, installing it to the General channel of a nominated Team.

Although I can make a call to the BOT, and it answers with the wav file in the Visual Studio project (which runs locally via ngrok), I am not seeing the adaptive card in Teams with which to do call control, as shown in the instructions/readme at

https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/bot-calling-meeting/csharp/README.md

Edit: I note that CallingBot.OnMembersAddedAsync() which looks like it might be responsible for showing the card, does fire when I add a new member to the team, but then throws the error: System.Exception.Message.get returned "Failed to acquire token for client credentials. (AADSTS700016: Application with identifier '<>' was not found in the directory 'Bot Framework'.

Any suggestions please - what am I missing

EDIT 26 Nov 21: configuration as follows

in the supplied manifest, we set 
=================================
the id to the           "Teams App ID"
we set the Bot id to the    "Azure Application (client) ID"


in the appsettings.json, we set
================================
  "MicrosoftAppId":         "Azure Application (client) ID"
  "MicrosoftAppPassword":   "Azure Application password"


  "AzureAd": {
    "TenantId":     "Company Tenant ID"
    "ClientId":     "Azure Application (client) ID"
    "ClientSecret":     "Azure Application password"

  "Bot": {
    "AppId":        "Azure Application (client) ID"
    "AppSecret":    "Azure Application password"


  "UserId": "User A id within Teams",

  "Users": [
    {
      "DisplayName":    "Name of User B",
      "Id":         "ID of User B"
    },
    {
      "DisplayName":    "Name of User C",
     "Id":      "ID of User C"
    },
    {
      "DisplayName":    "Name of User D",
     "Id":      "ID of User D"
    },
    {
      "DisplayName":    "Name of User E",
     "Id":      "ID of User E"
    }
  ]


When I add the manifest to a team with the code already running, OnMembersAddedAsync() fires and that leads to AdapterWithErrorHandler() firing with the exception :

"Failed to acquire token for client credentials. 
(AADSTS700016: Application with identifier '"Azure Application (client) ID"' was not found in the directory 'Bot Framework'. 
This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. 
You may have sent your authentication request to the wrong tenant.\r\n
Trace ID: 2eea2365-0e69-434d-befa-eeeb874a5101\r\n
Correlation ID: 0b06ce58-c03f-4a9b-a897-890f910269b7\r\nTimestamp: 2021-11-26 14:08:27Z)"

Solution

  • The problem here was that although we had set the BOT to be multitenant, we had not, additionally set the App to be multitenant. i.e., by doing :

    • Click Authentication
    • Make sure Supported Account Types is set to “Accounts in any organizational directory (Any Azure AD directory - Multitenant)”.
    • Click Save