Sending activity onBehalfOf does not resolve to a user
Github issues should be used for bugs and feature requests. Use Stack Overflow for general "how-to" questions.
Versions
botbuilder": "^4.20.0 node v18.20.3 Google Chrome Version 129.0.6668.101, Firefox 131.0.3 (aarch64) macOS 14.3 (23D56)
Describe the bug
We are sending an activity to a conversation. We want to use the onBehalfOf feature, so we append the appropriate properties (see the code snippet below). The config.onBehalfOf.oid is the oid of the trusted MicrosoftAADUser who triggers this action. We tested this with different users and the mri never got resolved and we always end up using the displayName as a fallback. We assume that the construction of the mri is correct, but also tried variants which only used config.onBehalfOf.oid as a value.
Question is: Is the construction of the mri correct? ("8:orgid:...) This worked a few months ago, so we assume it is either broken or a change happened, which we are not aware of.
let card = CardFactory.adaptiveCard(issueWithCard.card);
let activity: Partial<Activity> = MessageFactory.attachment(card);
if (config.onBehalfOf) {
activity.channelData = {
onBehalfOf: [{
itemid: 0,
mentionType: "person",
mri: "8:orgid:" + config.onBehalfOf.oid,
displayName: config.onBehalfOf.displayName
}]
};
}
let rootCardMessage = await client.conversations.sendToConversation(config.channelId, activity);
To Reproduce
Steps to reproduce the behavior:
- Send an activity using the sendToConversation function. Set onBehalfOf accordingly.
- Go to the conversation in Teams.
- Check if the message sender got resolved by onBehalfOf.mri or if the fallback is being used (displayName).
Expected behavior
We expect that the user's oid is being resolved and used by displaying the message including the onBehalfOf feature.
Hi @tomoyasoon
- See error
Is there an actual error message? Or the error is just that the mri doesn't get resolved?
Hi @dmvtech
There is no error message, I'll adjust my description accordingly - it is indeed the case, that the mri does not get resolved.