Teams Bot Notification Error: “operation returned an invalid status code ‘NotFound’” for Some Users
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:
- Why would SendMessage() return a NotFound error only for some users while working for others?
- Could ServiceUrl be stale for these users? How can I refresh it properly?
- What other reasons could cause SendMessage() to fail with NotFound for specific users?
- Is there a way to validate conversation references before sending a message to prevent failures?