Reputation: 125
MS BOT Framework bots not working on Microsoft teams channel. Its working fine on every other channel configured.
App ID: b3e237eb-7a3b-4b15-b8e1-4c30d1c94c77
code used:
[BotAuthentication]
public class MessagesController : ApiController
{
/// <summary>
/// POST: api/Messages
/// Receive a message from a user and reply to it
/// </summary>
public async Task<HttpResponseMessage> Post([FromBody]Activity activity)
{
if (activity.Type == ActivityTypes.Message)
{
ConnectorClient connector = new ConnectorClient(new Uri(activity.ServiceUrl));
if(activity.Text.ToUpper().Contains("EMAILS") || activity.Text.ToUpper().Contains("EMAIL") ||
activity.Text.ToUpper().Contains("MAILBOX") || activity.Text.ToUpper().Contains("OUTLOOK") )
{
// return our reply to the user
Activity reply = activity.CreateReply($"blah .. blah ..");
await connector.Conversations.ReplyToActivityAsync(reply);
reply = activity.CreateReply($"blah .. blah ..");
await connector.Conversations.ReplyToActivityAsync(reply);
reply = activity.CreateReply($"blah .. blah ..");
await connector.Conversations.ReplyToActivityAsync(reply); }
}
}
else
{
HandleSystemMessage(activity);
}
var response = Request.CreateResponse(HttpStatusCode.OK);
return response;
}
}
Upvotes: 1
Views: 1659
Reputation: 895
My issue was resolved after bots was enabled in the office 365 tenant administration for Microsoft Teams.
Apparently bots until recently worked fine without this permission being set. So when MS started to enforce it, existing bots or new bots wouldn't work in Teams anymore.
Upvotes: 1
Reputation: 572
Hello: I was able to add and test your bot to my Teams client. Per your sample, I entered "Mail" and got a response. Are you still seeing issues on your side?
Upvotes: 0