I have developed a bot to be used in Microsoft Teams, and I use OnMembersAddedAsync method to save user details such as conversation ID and AAD ID so that they can be used later to send proactive messages to the user in MS Teams. In case, even if I loose this details I used to uninstall and re-install the bot through App Studio or by Side loading the app in teams, the bot used to trigger this method and then I get the user details again.
Caption: Screenshot of Bot sending multiple welcome message as the bot was re-installed multiple times
Everything was working normal, but since this Monday, 20th July, 2020, the bot seems to have stopped calling that method and due to which now I am unable to get the user details if the user is re-installing the bot.
OnMembersAddedAsync method:
protected override async Task OnMembersAddedAsync(IList<ChannelAccount> membersAdded, ITurnContext<IConversationUpdateActivity> turnContext, CancellationToken cancellationToken)
{
try
{
Logger.LogInfo("In OnMembersAddedAsync.");
var welcomeText = "Hello and welcome!";
foreach (var member in membersAdded)
{
if (member.Id != turnContext.Activity.Recipient.Id)
{
await turnContext.SendActivityAsync(MessageFactory.Text(welcomeText, welcomeText), cancellationToken);
}
}
// Logic to save user details
}
catch (Exception ex)
{
Logger.LogError(ex.Message);
Logger.LogError(ex.StackTrace);
if (ex.InnerException != null)
{
Logger.LogError("Inner Exception: " + ex.InnerException.Message);
Logger.LogError("Inner Exception: " + ex.InnerException.StackTrace);
}
}
}
As of now this method is not even triggered and the first logger line is also not printed.
After doing some research, I have also added, OnConversationUpdateActivityAsync method, but even this method is not triggered:
protected override Task OnConversationUpdateActivityAsync(ITurnContext<IConversationUpdateActivity> turnContext, CancellationToken cancellationToken)
{
try
{
Logger.LogInfo("In OnConversationUpdateActivityAsync....");
return base.OnConversationUpdateActivityAsync(turnContext, cancellationToken);
}
catch (Exception ex)
{
Logger.LogError(ex.Message);
Logger.LogError(ex.StackTrace);
if (ex.InnerException != null)
{
Logger.LogError("Inner Exception: " + ex.InnerException.Message);
Logger.LogError("Inner Exception: " + ex.InnerException.StackTrace);
}
}
return base.OnConversationUpdateActivityAsync(turnContext, cancellationToken);
}
Packages used:
Microsoft.AspNet.Core(2.1.1)
Microsoft.Bot.Builder.Integration.AspNet.Core(4.7.0)
