Teams Bot Notification Error: “operation returned an invalid status code ‘NotFound’” for Some Users

Lahib Youssef 0 Reputation points
2025-03-14T08:09:05.3366667+00:00

I have developed a Teams bot that sends notifications to users who have the bot installed. The bot is working correctly for most users, but two specific users are consistently failing to receive notifications. When trying to send a message to these users, I receive the following error:

[OnTurnError] unhandled error : operation returned an invalid status code 'NotFound'

What I Have Tried:

Checked if GetPagedInstallationsAsync() returns a valid installation reference

Logged the ConversationReference before sending messages

Ensured that ServiceUrl is valid

Checked if users have uninstalled/reinstalled the bot

Key Questions:

  1. Why would SendMessage() return a NotFound error only for some users while working for others?
  2. Could ServiceUrl be stale for these users? How can I refresh it properly?
  3. What other reasons could cause SendMessage() to fail with NotFound for specific users?
  4. Is there a way to validate conversation references before sending a message to prevent failures?
Microsoft Teams | Development
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.