Always ConversationNotFound 404, even after welcome proactive message
Steffi3rd opened this issue · 6 comments
Hi !
Since this week-end,
Our bot always returns "ConversationNotFound" 404. We don't understand why.
The user has the conversation and the user exists in storage.
If I remove the user from the storage, I have the error "Not found" (this is normal).
So :
- the user exists in storage
- but conversation is not found whereas
- bot has successfully send the proactive message (Welcome...)
How to fix that?
POSTMAN
endpoint:
https://____.azurewebsites.net/api/notifications
payload:
{
"users": [{
"id": "_0_c_b_3-_a_8-4_4_-9_b_-_3_c_1_a_c_0"
}]
}
CODE
const { bot } = require("../internal/initialize");
const { AdaptiveCards } = require("@microsoft/adaptivecards-tools");
const { GetDeepLinkTabStatic } = require("../helpers/DeepLinkTabHelper.js");
const notificationTemplate = require("../adaptiveCards/notification-default.json");
const t = require("../internal/language.js");
module.exports = async ({ body }, res) => {
for await (const user of body.users) {
try {
const teamsMember = await bot.notification.findMember(async (member) => {
return member.account.aadObjectId === user.id;
});
if (!teamsMember) {
notFoundUsers.push(user.id);
continue;
}
const message = {
title: "Title",
description: "Description",
};
try {
await teamsMember.sendAdaptiveCard(
AdaptiveCards.declare(notificationTemplate).render(message),
async (_context, error) => {
throw new Error(error);
}
);
} catch (error) {
console.log("sendAdaptiveCard >>>", error);
throw new Error("sendAdaptiveCard : " + error);
}
} catch (error) {
console.log(`For ${user.id} : catch error >>>>>`, error);
continue;
}
}
return res.send(204);
};
Thanks @Steffi3rd, I'm investigating.
Hi @Steffi3rd, could you please provide the steps to reproduce this issue?
I found an alternative here : OfficeDev/TeamsFx#8759 (comment)
Hi @Steffi3rd,
Is this an issue with Bot Framework SDK or TeamsFx SDK?
@ramfattah The issue is : bot.notification.findMember(...)
@Steffi3rd, it seems that the method findMember(...) is a component of the TeamsFX SDK, not the Bot Framework SDK.
Please raise an issue in the TeamsFx repository.
Thank you.