I write .NET Core 3.1 bot for personal conversation in MS Teams. I use waterfall dialogs, which generate adaptive cards and I need to update or delete those cards after submitting. But whenever I try call UpdateActivityAsync or DeleteActivityAsync methods, I've got error:
Operation returned an invalid status code 'Forbidden'. {"error":{"code":"BotNotInConversationRoster","message":"The bot is not part of the conversation roster."}}
But the error is not connected with adaptive cards. I tried this code and still have the same error:
var oldActivity = MessageFactory.Text("Old activity");
var activity_id = stepContext.Context.Activity.Id;
await stepContext.Context.SendActivityAsync(oldActivity);
var newActivity = MessageFactory.Text("New activity");
newActivity.Id = activity_id;
await stepContext.Context.UpdateActivityAsync(newActivity); //error!
or
var oldActivity = MessageFactory.Text("Old activity");
var activity_id = stepContext.Context.Activity.Id;
await stepContext.Context.SendActivityAsync(oldActivity);
await stepContext.Context.DeleteActivityAsync(activity_id);// error!
By the way call to personal info:
var member = await TeamsInfo.GetMemberAsync(stepContext.Context,
stepContext.Context.Activity.From.Id, cancellationToken);
is successful.
What may be wrong?