Open Steffi3rd opened 11 months ago
Thank you for contacting us! Any issue or feedback from you is quite important to us. We will do our best to fully respond to your issue as soon as possible. Sometimes additional investigations may be needed, we will usually get back to you within 2 days by adding comments to this issue. Please stay tuned.
@Steffi3rd , do you mean that the bot.notification.findMember
can find the member but teamsMember.sendAdaptiveCard
throws "ConversationNotFound"?
Since you have the user in storage, it should look like:
"...": {
"activityId": "...",
"user": {
"aadObjectId": "_0_c_b_3-_a_8-4_4_-9_b_-_3_c_1_a_c_0"
},
"conversation": {
"id": "xxxxxxxxxxx"
},
...
}
"ConversationNotFound" means the conversation id is invalid. Some user operations such as blocking the bot or deleting the bot may impact that id. So could you please try uninstall/reinstall the bot app to see if the conversation id changes?
Hello @swatDong,
This code returns 404 ; ConversationNotFound even if user exists in storage.
const teamsMember = await bot.notification.findMember(async (member) => {
return member.account.aadObjectId === body.user.id;
});
if (!teamsMember) {
return res.json(404, { status: "error", message: "User not found" });
}
await teamsMember.sendAdaptiveCard(
AdaptiveCards.declare(notificationTemplate).render({
title: "Title",
description: "Description",
})
);
I tried what you suggest, so for my account :
Response from the bot :
"body": "{\"type\":\"message\",\"serviceUrl\":\"https://smba.trafficmanager.net/apac/\",\"channelId\":\"msteams\",\"from\":{\"id\":\"xxx\",\"name\":\"xxxxxx\"},\"conversation\":{\"conversationType\":\"personal\",\"id\":\"a:1xDVUzAk_xBG50u2qSy-59jrOMHBzTvYz3r6AXmAVF5XiozyNlNfN3Tga6fz3VjR8GmtnbCmcvfatTR5XW6K4aekQRj6W4ZSxbRzPq15Z3VCcVEOWAKuHSALQMhQvlrJi\",\"tenantId\":\"**43655375-9f9c-4ffa-b7ed-e0a1a4f04fb7**\"},\"recipient\":{\"id\":\"29:1FzWxjMz7w1sAJ91rVMIrjwjHIAw7JjyaefyoarGfJ3jQ62u5zC66okofWhV4S23pFo-Wt08PXk99FTJ3sTp1tQ\",\"aadObjectId\":\"5cf20fba-f827-46c9-a571-660d686e1519\"},\"locale\":\"en-GB\",\"text\":\"The bot encountered unhandled error: Conversation not found.\",\"inputHint\":\"acceptingInput\",\"replyToId\":\"f:13a04c4b-fe92-8b34-19c2-9ec5d7df8541\"}",
tenantId : 43655375-9f9c-4ffa-b7ed-e0a1a4f04fb7
: This is not my tenantId
aadObjectId : 5cf20fba-f827-46c9-a571-660d686e1519
: This is not my aadObjectId
In storage
{"activityId":"xxx","user":{"id":"xxx","aadObjectId":"xxx"},"bot":{"id":"xxx","name":"xxx"},"conversation":{"conversationType":"personal","tenantId":"64c0ba7f-e13e-418e-9ae0-d810b3074586","id":"a:1iv4fn8Sgm70px508gmdyNc1OoHLXwRpHaaAken9K3p2Y7GM8W4P4qR_-J_iMLTu8DFGBIOZ8DzGO50VR_M4-GxRhRsp69rj__KnEwbxGPf2i0-LKEf0QSASS1m9sHzBh"},"channelId":"msteams","locale":"fr-FR","serviceUrl":"https://smba.trafficmanager.net/fr/"}
Same response from the bot : Why? There's something really wrong here... Is it cached or something?
"body": "{\"type\":\"message\",\"serviceUrl\":\"https://smba.trafficmanager.net/apac/\",\"channelId\":\"msteams\",\"from\":{\"id\":\"28:a00493d8-18c2-4fdc-99fb-712149edd790\",\"name\":\"xxxxxx\"},\"conversation\":{\"conversationType\":\"personal\",\"id\":\"a:1xDVUzAk_xBG50u2qSy-59jrOMHBzTvYz3r6AXmAVF5XiozyNlNfN3Tga6fz3VjR8GmtnbCmcvfatTR5XW6K4aekQRj6W4ZSxbRzPq15Z3VCcVEOWAKuHSALQMhQvlrJi\",\"tenantId\":\"**43655375-9f9c-4ffa-b7ed-e0a1a4f04fb7**\"},\"recipient\":{\"id\":\"29:1FzWxjMz7w1sAJ91rVMIrjwjHIAw7JjyaefyoarGfJ3jQ62u5zC66okofWhV4S23pFo-Wt08PXk99FTJ3sTp1tQ\",\"aadObjectId\":\"5cf20fba-f827-46c9-a571-660d686e1519\"},\"locale\":\"en-GB\",\"text\":\"The bot encountered unhandled error: Conversation not found.\",\"inputHint\":\"acceptingInput\",\"replyToId\":\"f:13a04c4b-fe92-8b34-19c2-9ec5d7df8541\"}",
I log bot.notification.findMember(async (member) => console.log(member))
What I found is that, bot.notification.findMember is display only 5 members (of 40 members)... why ?
Those member are users who have dowloaded/install app (exist in storage) but are not real users of my apps
[ { "from": "findMember", "isFound": false, "member": { "type": "Person", "parent": { "adapter": { "middleware": { "middleware": [ null, null ] }, "settings": {}, "credentials": { "name": "MicrosoftAppCredentials", "appId": "a00493d8-18c2-4fdc-99fb-712149edd790", "tenant": "botframework.com", "oAuthEndpoint": "https://login.microsoftonline.com/botframework.com", "oAuthScope": "https://api.botframework.com" }, "credentialsProvider": { "name": "SimpleCredentialProvider", "appId": "a00493d8-18c2-4fdc-99fb-712149edd790" }, "isEmulatingOAuthCards": false, "authConfiguration": { "requiredEndorsements": [] } }, "conversationReference": { "activityId": "f:2edd0213-972c-3b80-e0b3-2e583304cabb", "user": { "id": "29:17aTDtB-KLg2A1jWc-aR8UCBoeVBuZ1P2rieJPEQZeHFQwyaryWDxemx5OmGC4NxUUrXBxw7nt9fJu4MQrDpDDw", "aadObjectId": "a55197cc-aba9-41c3-b128-abd1dc3f2dc7" }, "bot": {}, "conversation": { "conversationType": "personal", "tenantId": "0fd385fe-c3d6-4712-9388-3eb00503c6f3", "id": "a:1kn0SjToqv1O7D9YCj3kKX3XL0fjNUw4-8dt2rqkve9p8szzcvGk8feGGRPnX3UbxCjH0zayuTyY5nvOU6mMmFBbUbiw7k9Izqb4WWh5jEZCvtGw7bPiBMhVpajVkErsq" }, "channelId": "msteams", "locale": "en-US", "serviceUrl": "https://smba.trafficmanager.net/amer/" }, "type": "Person" }, "account": { "id": "29:17aTDtB-KLg2A1jWc-aR8UCBoeVBuZ1P2rieJPEQZeHFQwyaryWDxemx5OmGC4NxUUrXBxw7nt9fJu4MQrDpDDw", "name": "Walter Macanche", "aadObjectId": "a55197cc-aba9-41c3-b128-abd1dc3f2dc7", "givenName": "Walter", "surname": "Macanche", "email": "wmacanche@techgames505.onmicrosoft.com", "userPrincipalName": "wmacanche@techgames505.onmicrosoft.com", "tenantId": "0fd385fe-c3d6-4712-9388-3eb00503c6f3", "userRole": "user" } } }, { "from": "findMember", "isFound": false, "member": { "type": "Person", "parent": { "adapter": { "middleware": { "middleware": [ null, null ] }, "settings": {}, "credentials": { }, "credentialsProvider": {}, "isEmulatingOAuthCards": false, "authConfiguration": { "requiredEndorsements": [] } }, "conversationReference": { "activityId": "f:2d5cbd5d-3305-c08a-6765-60c12c80e9e9", "user": { "id": "29:1qzvKzPRrAXLROxww9cTVjUJ4gFkyT3XDHUTWYIZxFk8YolpAdRBHOSV-4nu5CmYb2XSIo-CY0rWOTyg_YWG71g", "aadObjectId": "6d009e52-29e1-4e89-b684-db324914e8f3" }, "bot": {}, "conversation": { "conversationType": "personal", "tenantId": "23a1ff90-9298-4645-bd33-b0333a14511f", "id": "a:1km5njy76cne4bb7tNwkVwayBq2mL60GzdozqOOTnIhl9QMJql6tjftNTQgXU5G_HjmxbwgiO37P4qBC2wwmGsWH-vviR0pRgaUYN6l9uHfD0p8dN5FS9tJNhklUkYYN8" }, "channelId": "msteams", "locale": "en-US", "serviceUrl": "https://smba.trafficmanager.net/amer/" }, "type": "Person" }, "account": { "id": "29:1qzvKzPRrAXLROxww9cTVjUJ4gFkyT3XDHUTWYIZxFk8YolpAdRBHOSV-4nu5CmYb2XSIo-CY0rWOTyg_YWG71g", "name": "MOD Administrator", "aadObjectId": "6d009e52-29e1-4e89-b684-db324914e8f3", "givenName": "MOD", "surname": "Administrator", "email": "admin@M365x47423273.OnMicrosoft.com", "userPrincipalName": "admin@M365x47423273.onmicrosoft.com", "tenantId": "23a1ff90-9298-4645-bd33-b0333a14511f", "userRole": "user" } } }, { "from": "findMember", "isFound": false, "member": { "type": "Person", "parent": { "adapter": { "middleware": { "middleware": [ null, null ] }, "settings": {}, "credentials": { }, "credentialsProvider": {}, "isEmulatingOAuthCards": false, "authConfiguration": { "requiredEndorsements": [] } }, "conversationReference": { "activityId": "f:3db178c0-4c6d-621e-4acb-fcf7e28a1410", "user": { "id": "29:1XTogOZdpYWABon15610jfnXTcj_AqSDlKn7w5vqUddxqoslSjt2vF5dQ_9bJZxbvYKdgCkOr_4lxZBDYn5zAQg", "aadObjectId": "f73f6218-cda3-4df9-80d3-a754a922b54c" }, "bot": {}, "conversation": { "conversationType": "personal", "tenantId": "283c5949-c1d5-46e2-acd1-f6e320a91325", "id": "a:1b8WBenpRr3mN-DdSUitbp3rUbIv2pWHU27nWWsBI7OlaGUgGbOmRmQCBFC2CSmgnjVjWdviHgLvPOO7mVIiCTLfcQeu427QD3cqnGxP39DjncvBeR94vHH30u6cELolG" }, "channelId": "msteams", "locale": "en-US", "serviceUrl": "https://smba.trafficmanager.net/amer/" }, "type": "Person" }, "account": { "id": "29:1XTogOZdpYWABon15610jfnXTcj_AqSDlKn7w5vqUddxqoslSjt2vF5dQ_9bJZxbvYKdgCkOr_4lxZBDYn5zAQg", "name": "Felipe Ochoa", "aadObjectId": "f73f6218-cda3-4df9-80d3-a754a922b54c", "givenName": "Felipe", "surname": "Ochoa", "email": "fochoa@usmotorworks.com", "userPrincipalName": "fochoa@usmotorworks.com", "tenantId": "283c5949-c1d5-46e2-acd1-f6e320a91325", "userRole": "user" } } }, { "from": "findMember", "isFound": false, "member": { "type": "Person", "parent": { "adapter": { "middleware": { "middleware": [ null, null ] }, "settings": {}, "credentials": { }, "credentialsProvider": {}, "isEmulatingOAuthCards": false, "authConfiguration": { "requiredEndorsements": [] } }, "conversationReference": { "activityId": "f:67f2ade5-4628-4bbc-3d90-9d5258f96afc", "user": { "id": "29:15bNAC98RfcVx8NeSss9iDQYC1HWmqejk5gdsJwU6IRXtOiL-eLj7-DtjybRjWdqyTlHh5eXOPQMtq73EgJrZDA", "aadObjectId": "931c4dd9-db54-40cd-9a3e-a0caea6943c9" }, "bot": {}, "conversation": { "conversationType": "personal", "tenantId": "287b6bd0-667d-49e8-af09-17bf6c0aafcf", "id": "a:1z_5gCxjE-_sOI7q5l2P-DgNfCkkl2JTpK1YHv53n8Rm1s2dUw1ihG1NBPuJzmaon4wEdlbKlF7ilT1WtdubILP2Acyvy-eD4t08OvBM2IYMHlqL9OmeJLYqb28xD-dXU" }, "channelId": "msteams", "locale": "en-US", "serviceUrl": "https://smba.trafficmanager.net/amer/" }, "type": "Person" }, "account": { "id": "29:15bNAC98RfcVx8NeSss9iDQYC1HWmqejk5gdsJwU6IRXtOiL-eLj7-DtjybRjWdqyTlHh5eXOPQMtq73EgJrZDA", "name": "MOD Administrator", "aadObjectId": "931c4dd9-db54-40cd-9a3e-a0caea6943c9", "givenName": "MOD", "surname": "Administrator", "email": "admin@M365x69917425.OnMicrosoft.com", "userPrincipalName": "admin@M365x69917425.onmicrosoft.com", "tenantId": "287b6bd0-667d-49e8-af09-17bf6c0aafcf", "userRole": "user" } } }, { "from": "findMember", "isFound": false, "member": { "type": "Person", "parent": { "adapter": { "middleware": { "middleware": [ null, null ] }, "settings": {}, "credentials": { }, "credentialsProvider": {}, "isEmulatingOAuthCards": false, "authConfiguration": { "requiredEndorsements": [] } }, "conversationReference": { "activityId": "f:58e255e8-c14b-262c-b3d8-2c52d65abc83", "user": { "id": "29:1oe_Hc0PfS6RDwOE02INwg2W5nLM7j2I3Mq_WPp1itdrH_lrVYba05wqETj684zS6KRoeWCoEQNkFFV_7KpcszQ", "aadObjectId": "7da95451-e1a5-4230-b770-343e11ad5ba5" }, "bot": {}, "conversation": { "conversationType": "personal", "tenantId": "321a2172-3913-40d4-b65b-11d9ec5b7cc6", "id": "a:1SVbazdBkfBU22Z2i6EYZMaKyOiLEfdA3fEIz5nWZdZr-Pde5LckgN9vQHuBVXDUpyCrJCZCykeE3_dKI1sW92zBuWq8m5P8qczlkxr3r1WdAtjMN9JAqt7BhhhR2raiw" }, "channelId": "msteams", "locale": "en-US", "serviceUrl": "https://smba.trafficmanager.net/apac/" }, "type": "Person" }, "account": { "id": "29:1oe_Hc0PfS6RDwOE02INwg2W5nLM7j2I3Mq_WPp1itdrH_lrVYba05wqETj684zS6KRoeWCoEQNkFFV_7KpcszQ", "name": "Ellie Cogill", "aadObjectId": "7da95451-e1a5-4230-b770-343e11ad5ba5", "givenName": "Ellie", "surname": "Cogill", "email": "ellie.cogill@allsportsphysio.com.au", "userPrincipalName": "ellie.cogill@healthia.com.au", "tenantId": "321a2172-3913-40d4-b65b-11d9ec5b7cc6", "userRole": "user" } } } ]
@Steffi3rd, do you mean that members in your storage do not match the findMember
result? Do you have access to your storage's raw data? Does the storage data match your bot.notification.findMember(async (member) => console.log(member))
log results?
Technically, findMember
just iterates the data in your storage to get members:
In addition, the notification storage only records those who installed the app. So I got a bit confused on "your app's real users". Do you have the scenario that user can use your app without installing?
Since you mentioned the error tenant and object id are not yours, it's possible that the user's tenant or account had some changes that made the conversation invalid.
Are you able to try a fixed user in those steps?
findMember
with user X's idIn addition, the notification storage only records those who installed the app. So I got a bit confused on "your app's real users". Do you have the scenario that user can use your app without installing?
I mean that My app is tab based + bot. The bot can sends notification only if user has an active account to tabs. But that's not a problem π
do you mean that members in your storage do not match the findMember result? No, findMember result exist in storage but only 5 of them is in the result. I have more than 40 members in the storage, but 35 users are not in console.log, why ?
Do you have access to your storage's raw data? Yes I have access to storage's raw data, that's where I look.
Technically, findMember just iterates the data in your storage to get members:
if person, just treat as a member if group chat, list all members of that group if team channel, list all members of that team
Yes I know, but why only 5 of them is returned bot.notification.findMember()
Yes I tried that.
Since you mentioned the error tenant and object id are not yours, it's possible that the user's tenant or account had some changes that made the conversation invalid.
Are you able to try a fixed user in those steps?
User X installs the app and able to chat with the bot app User X exists in your storage Call findMember with user X's id Is the find result user X?
Here 404 ConversationNotFound
Send message If still error, does the error response represent user X?
ConversationNotFound does not represent user X but the 6th user in storage who is neither display in findMemberResult.
So
Bot response
"body": "{\"type\":\"message\",\"serviceUrl\":\"https://smba.trafficmanager.net/apac/\",\"channelId\":\"msteams\",\"from\":{\"id\":\"xxx\",\"name\":\"xxxxxx\"},\"conversation\":{\"conversationType\":\"personal\",\"id\":\"a:1xDVUzAk_xBG50u2qSy-59jrOMHBzTvYz3r6AXmAVF5XiozyNlNfN3Tga6fz3VjR8GmtnbCmcvfatTR5XW6K4aekQRj6W4ZSxbRzPq15Z3VCcVEOWAKuHSALQMhQvlrJi\",\"tenantId\":\"**43655375-9f9c-4ffa-b7ed-e0a1a4f04fb7**\"},\"recipient\":{\"id\":\"29:1FzWxjMz7w1sAJ91rVMIrjwjHIAw7JjyaefyoarGfJ3jQ62u5zC66okofWhV4S23pFo-Wt08PXk99FTJ3sTp1tQ\",\"aadObjectId\":\"5cf20fba-f827-46c9-a571-660d686e1519\"},\"locale\":\"en-GB\",\"text\":\"The bot encountered unhandled error: Conversation not found.\",\"inputHint\":\"acceptingInput\",\"replyToId\":\"f:13a04c4b-fe92-8b34-19c2-9ec5d7df8541\"}",
Storage list
Why bot.notification.findMember() does this ? π€
@swatDong
I tried another UNOPTIMIZED approach, which works... by using :
const target of await bot.notification.installations()
So is bot.notification.findMember() has bug ? or what's wrong? That situation is only since this weekend... weird π€
const users = [];
const selectedUsers = [];
const bodyUserIds = body.users.map((user) => user.id);
// list all installation targets
for (const target of await bot.notification.installations()) {
// "Person" means this bot is installed as Personal app
try {
if (target.type === "Person") {
const userId = target.conversationReference.user.aadObjectId;
users.push({
userId
});
if (bodyUserIds.includes(userId)) {
selectedUsers.push({
userId
});
try {
await target.sendAdaptiveCard(
AdaptiveCards.declare(notificationTemplate).render(message),
async (_context, error) => {
throw new Error("teamsMember.sendAdaptiveCard : " + error);
}
);
} catch (error) {
throw new Error("sendAdaptiveCard : " + error);
}
}
}
} catch (error) {
continue;
}
}
return res.json(200, {
selectedUsers,
users,
errors,
});
@Steffi3rd , since installations()
works, the cause could be "bot app is installed to a group chat or team channel".
installations()
exactly returns the same count as those items in storage.findMember()
expands the GroupChat and TeamChannel items in storage so it may iterate more.In your scenario, the 6 items in the storage may contain 5 Person and 1 GroupChat or TeamChannel. To find person only, you can pass SearchScope
to findMember()
:
import { BotBuilderCloudAdapter } from "@microsoft/teamsfx";
...
const member = await bot.notification.findMember(
async () => {
...;
},
BotBuilderCloudAdapter.SearchScope.Person // Use search scope to search person installations only
);
Thanks @swatDong! I'll try that.
My bot is only available for "personal", no group, no teams.
So I would like to understand why when I search user YYYYY (it's my id), the 6th is true (knowing that YYYYY is not in group or in teams)
Which group id or teams id (member.account.aadObjectId) equals to my user id XXXX ? π€
const teamsMember = await bot.notification.findMember(async (member) => {
return member.account.aadObjectId === "YYYYY";
});
Because in the body response returned by the ConversationNotFound (404), the aadObjectId
found is 5cf20fba-f827-46c9-a571-660d686e1519
which is not my id YYYYY
.
"body": "{\"type\":\"message\",\"serviceUrl\":\"https://smba.trafficmanager.net/apac/\",\"channelId\":\"msteams\",\"from\":{\"id\":\"xxx\",\"name\":\"xxxxxx\"},\"conversation\":{\"conversationType\":\"personal\",\"id\":\"a:1xDVUzAk_xBG50u2qSy-59jrOMHBzTvYz3r6AXmAVF5XiozyNlNfN3Tga6fz3VjR8GmtnbCmcvfatTR5XW6K4aekQRj6W4ZSxbRzPq15Z3VCcVEOWAKuHSALQMhQvlrJi\",\"tenantId\":\"**43655375-9f9c-4ffa-b7ed-e0a1a4f04fb7**\"},\"recipient\":{\"id\":\"29:1FzWxjMz7w1sAJ91rVMIrjwjHIAw7JjyaefyoarGfJ3jQ62u5zC66okofWhV4S23pFo-Wt08PXk99FTJ3sTp1tQ\",\"aadObjectId\":\"5cf20fba-f827-46c9-a571-660d686e1519\"},\"locale\":\"en-GB\",\"text\":\"The bot encountered unhandled error: Conversation not found.\",\"inputHint\":\"acceptingInput\",\"replyToId\":\"f:13a04c4b-fe92-8b34-19c2-9ec5d7df8541\"}",
@Steffi3rd , findMember()
calls installations()
internally (source code here).
So if installations()
works for you, could also try like this:
for (const target of await bot.notification.installations()) {
const members = await target.members();
for (const member of members) {
// check member id or other fields
}
}
This is to call members()
on each installation to see if the result, especially objectId, is expected.
OMG
const member = await bot.notification.findMember(
async () => { ... },
BotBuilderCloudAdapter.SearchScope.Person
);
still returns ConversationNotFound
π€―
I guess something wrong here (in my case, I don't know why) : https://github.com/OfficeDev/TeamsFx/blob/735b0b61a3ca9d69b2ed2a4c4145b7bdf5cc5e95/packages/sdk/src/conversationWithCloudAdapter/notification.ts#L709
Which one this better ?
for (const target of await bot.notification.installations()) {
const members = await target.members();
for (const member of members) {
// check member id or other fields
}
}
for (const target of await bot.notification.installations()) {
const memberId = target.conversationReference.user.aadObjectId;
if (target.type === "Person") {
if(memberId === "YYYY") {
...
}
}
}
target.conversationReference.user.aadObjectId
is the exact value from your storage.target.members()
will call remote Teams API to get member info.So target.conversationReference.user.aadObjectId
should be enough for your scenario. For target.members()
, it could show how the user id matches, so probably a debug proposal.
Thanks @swatDong! π
Otherwise is it normal that every request to the bot https://_ .azurewebsites.net/api/____ is minimum 15 seconds? How to optimize that?
The more users install, the slower it will be (40s, 60s, 120s...) π€
Iterating installations()
is a sequential call so the user count does impact the performance.
To optimize, the target can be cached/persisted (e.g., in memory) or other places, and you can add your own parallel logic to speed up.
for (const target of await bot.notification.installations()) {
const memberId = target.conversationReference.user.aadObjectId;
if (target.type === "Person") {
if(memberId === "YYYY") {
//cache the conversation reference
target.conversationReference ...
}
}
}
...
// construct target from conversation reference
const target = new TeamsBotInstallation(bot.adapter, conversationReference, "your-bot-id");
target.send...
I'll check internally to see if certain optimization can be added to the teamsfx sdk.
I'll check internally to see if certain optimization can be added to the teamsfx sdk.
Thank you! Let us know π
@swatDong I had similar issue yesterday , I guess ValidateInstallation
should return false
on all errors.
@swatDong I had similar issue yesterday , I guess
ValidateInstallation
should returnfalse
on all errors.
There was a server side issue (https://github.com/OfficeDev/TeamsFx/issues/10059) that may cause ValidateInstallation
returning unexpected error.
@swatDong
A similar issue has suddenly occurred since yesterday. Please let me know if there is a way to solve it.
ERROR : ConversationNotFound 404
[Request] POST /api/notification HTTP/1.1 Host: botxxxxxx.azurewebsites.net Content-Type: application/json Content-Length: 949
{
"asynchronize": "true",
"sender": {
"iconSrc": "https://xxxxx /512/1498/1498920.png",
"displayName": "displayName"
},
"target": {
"type": "member",
"members": [
"PD292805@xxxxxx.com"
],
"groups": [],
"channels": []
]
},
"content": {
"type": "form",
"subject": "Test Subject",
"body": "Test body",
"imageSrc": "https://image.dongascience.com/Photo/2016/01/14538781814249.jpg",
"actionIconSrc": "https://cdn-icons-png.flaticon.com/512/1498/1498920.png",
"actionTitle": "title",
"actionUrl": "https://m.naver.com"
}
}
[Response] { "code": "ConversationNotFound", "statusCode": 404, "request": { "streamResponseBody": false, "url": "https://smba.trafficmanager.net/kr/v3/conversations/a%3AxxxxFTeNYEzOhvEKrfD_I68Pz-I5MpPxYxMa4BWBt6mvK1RAdx6Q4An1tACtcwjM3WUVku_Cdi-w3glBYOu-JaIaUU4dqsrUwTDDcbx5rB3rQRHChSeJXtOvEFfsufw/activities/xxxxx0-d499-4dfc-b483-a46e5ff35ec8", "method": "POST", .... .... "body": "{\"type\":\"message\",\"serviceUrl\":\"https://smba.trafficmanager.net/kr/\",\"channelId\":\"msteams\",\"from\":{\"id\":\"28:xxxxxx-2cbc-4152-8f8c-33bd7c5db18b\",\"name\":\"PosNotification\"},\"conversation\":{\"conversationType\":\"personal\",\"id\":\"a:xxxxxxD_I68Pz-I5MpPxYxMa4BWBt6mvK1RAdx6Q4An1tACtcwjM3WUVku_Cdi-w3glBYOu-JaIaUU4dqsrUwTDDcbx5rB3rQRHChSeJXtOvEFfsufw\",\"tenantId\":\"xxxxxxxe7fe-4e89-8343-bfbb9434a292\"},\"recipient\":{\"id\":\"29:1xxxxxZfRZ7VheblttpjEJSgZ-17ugJBTUCW0xMn6Ca-_p8Ub-DIakpb_pxowU2BLNNjzUpxuUz0IQAlbgQjBGw\",\"aadObjectId\":\"xxxx-b480-471d-8c71-2b7397d927ff\"},\"locale\":\"ko-KR\",\"text\":\"The bot encountered unhandled error: Conversation not found.\",\"inputHint\":\"acceptingInput\",\"replyToId\":\"xxxxxx-d499-4dfc-b483-a46e5ff35ec8\"}", "withCredentials": false, "timeout": 0, "operationSpec": { .... ....
"body": { "error": { "code": "ConversationNotFound", "message": "Conversation not found." } }
@jslee82 - does this occur on specific chat/channel or different chats/channels/bots? 404 is expected if bot sends message to a deleted chat/conversation/post.
@swatDong No error occurs when a bot installed in chats or a channel sends a message. I only get the error when sending to the user(member).
Additional info.. Blob storage contains the following data:
FileName : _496ce294-e7fe-4e89-8343-bfbb9434a292_a%3A16lGdYFTeNYEzOhvEKrfD_I68Pz-I5MpPxYxMa4BWBt6mvK1RAdx6Q4An1tACtcwjM3WUVku_Cdi-w3glBYOu-JaIaUU4dqsrUwTDDcbx5rB3rQRHChSeJXtOvEFfsufw
FileContents { "activityId":"f:3ab1d68c-1556-5440-6878-40985ca9aff4", "user":{ "id":"29:1w8DR7ZfRZ7VheblttpjEJSgZ-17ugJBTUCW0xMn6Ca-_p8Ub-DIakpb_pxowU2BLNNjzUpxuUz0IQAlbgQjBGw", "aadObjectId":"96408567-b480-471d-8c71-2b7397d927ff" }, "bot":{ "id":"28:xxxxxxxx-2cbc-4152-8f8c-33bd7c5db18b", "name":"PosNotification" }, "conversation":{ "conversationType":"personal", "tenantId":"xxxxxxx-xxxxx-xx-xx3-xxx2", "id":"a:16lGdYFTeNYEzOhvEKrfD_I68Pz-I5MpPxYxMa4BWBt6mvK1RAdx6Q4An1tACtcwjM3WUVku_Cdi-w3glBYOu-JaIaUU4dqsrUwTDDcbx5rB3rQRHChSeJXtOvEFfsufw" }, "channelId":"msteams", "locale":"ko-KR", "serviceUrl":"https://smba.trafficmanager.net/kr/" }
@swatDong No error occurs when a bot installed in chats or a channel sends a message. I only get the error when sending to the user(member).
Additional info.. Blob storage contains the following data:
FileName : _496ce294-e7fe-4e89-8343-bfbb9434a292_a%3A16lGdYFTeNYEzOhvEKrfD_I68Pz-I5MpPxYxMa4BWBt6mvK1RAdx6Q4An1tACtcwjM3WUVku_Cdi-w3glBYOu-JaIaUU4dqsrUwTDDcbx5rB3rQRHChSeJXtOvEFfsufw
FileContents { "activityId":"f:3ab1d68c-1556-5440-6878-40985ca9aff4", "user":{ "id":"29:1w8DR7ZfRZ7VheblttpjEJSgZ-17ugJBTUCW0xMn6Ca-_p8Ub-DIakpb_pxowU2BLNNjzUpxuUz0IQAlbgQjBGw", "aadObjectId":"96408567-b480-471d-8c71-2b7397d927ff" }, "bot":{ "id":"28:xxxxxxxx-2cbc-4152-8f8c-33bd7c5db18b", "name":"PosNotification" }, "conversation":{ "conversationType":"personal", "tenantId":"xxxxxxx-xxxxx-xx-xx3-xxx2", "id":"a:16lGdYFTeNYEzOhvEKrfD_I68Pz-I5MpPxYxMa4BWBt6mvK1RAdx6Q4An1tACtcwjM3WUVku_Cdi-w3glBYOu-JaIaUU4dqsrUwTDDcbx5rB3rQRHChSeJXtOvEFfsufw" }, "channelId":"msteams", "locale":"ko-KR", "serviceUrl":"https://smba.trafficmanager.net/kr/" }
That may be caused by user removing/blocking the bot, or even user is removed...
One possible workaround is removing the file and let user to re-install/message the bot again.
Or, explicitly create new conversation (see https://learn.microsoft.com/en-us/microsoftteams/platform/bots/how-to/conversations/send-proactive-messages#create-the-conversation)
Our issue was resolved, but the exact cause was not identified. The error occurred in the code below.
if (target.type === "Person") { const members = await target.members();
An error occurred in a specific user's data, and the app worked normally after deleting and reinstalling it using the Graph API. Can you tell me the probable cause and prevention method for this issue?
Our issue was resolved, but the exact cause was not identified. The error occurred in the code below.
if (target.type === "Person") { const members = await target.members();
An error occurred in a specific user's data, and the app worked normally after deleting and reinstalling it using the Graph API. Can you tell me the probable cause and prevention method for this issue?
For the code:
if (target.type === "Person") {
const members = await target.members();
You could just remove the .members()
call and directly use target
to send message since it's already a person.
I cannot repro that on my side. Just guess - some user-side operations cause target
and target.members()
have different conversation ids.
Describe the bug 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 :
How to fix that?
POSTMAN
endpoint:
payload:
CODE
Expected behavior No "ConversationNotFound". Message should be delivered.