I am currently following Teams Conversation Bot sample. I have followed it to the letter as far as i can see.
What works.
When i talk to the bot though the web view
I can see it hitting the code on my localhost.
protected override async Task OnMessageActivityAsync(ITurnContext<IMessageActivity> turnContext, CancellationToken cancellationToken)
{
turnContext.Activity.RemoveRecipientMention();
switch (turnContext.Activity.Text.Trim())
{
case "MentionMe":
await MentionActivityAsync(turnContext, cancellationToken);
break;
case "UpdateCardAction":
await UpdateCardActivityAsync(turnContext, cancellationToken);
break;
case "Delete":
await DeleteCardActivityAsync(turnContext, cancellationToken);
break;
case "MessageAllMembers":
await MessageAllMembersAsync(turnContext, cancellationToken);
break;
default:
var value = new JObject { { "count", 0 } };
var card = new HeroCard
{
Title = "Welcome Card",
Text = "Click the buttons below to update this card",
Buttons = new List<CardAction>
{
new CardAction
{
Type= ActionTypes.MessageBack,
Title = "Update Card",
Text = "UpdateCardAction",
Value = value
},
new CardAction
{
Type = ActionTypes.MessageBack,
Title = "Message all members",
Text = "MessageAllMembers"
}
}
};
await turnContext.SendActivityAsync(MessageFactory.Attachment(card.ToAttachment()));
break;
}
}
what doesn't work
It appears to send the response back but nothing appears in the response window. How do i test this if it doesn't show the response?
Ngrok error
After a bit more digging I can see that ngrok is getting an error back of sorts its a web page I managed to pick the following error out of it.
AggregateException: Failed to acquire token for client credentials. (AADSTS700016: Application with identifier '9e0d71-7665-4f24-8898-f82f9bebba56' was not found in the directory 'botframework.com'. 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.
Trace ID: 4bf53bae-84dc-4b16-98e8-e99b322dc200
Correlation ID: 3c249469-d177-49dd-989f-80044a3b9faa
Timestamp: 2019-11-12 08:41:56Z) (AADSTS700016: Application with identifier 'e0d71-7665-4f24-8898-f82f9bebba56' was not found in the directory 'botframework.com'. 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.
I have checked the settings on the bot and the application itself. They have the same secret and application client id.
botframework.com appears to contain a list of bots that were created on azure.
What i have tried.
- Visual studio is running as administrator.
Chckedbotframework.com my bot is listed.
Users have the write to create apps in AD, I am currently the only user anyway.
- dev tools logs shows its authenticating.
- Edge and chrome
web chat errors
I can see in the bot that its logging errors with the web chat
The thing is the bot is responding.
Emulator
Running the emulator does work. The issue is when hosted.
cross posted
Issue #1974