botbuilder-js icon indicating copy to clipboard operation
botbuilder-js copied to clipboard

Sending activity onBehalfOf does not resolve to a user

Open tomoyasoon opened this issue 1 year ago • 2 comments

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:

  1. Send an activity using the sendToConversation function. Set onBehalfOf accordingly.
  2. Go to the conversation in Teams.
  3. 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.

tomoyasoon avatar Nov 06 '24 10:11 tomoyasoon

Hi @tomoyasoon

  1. See error

Is there an actual error message? Or the error is just that the mri doesn't get resolved?

dmvtech avatar Nov 14 '24 17:11 dmvtech

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.

tomoyasoon avatar Nov 18 '24 14:11 tomoyasoon