question

IsakEngstrm-2613 avatar image
0 Votes"
IsakEngstrm-2613 asked brtrach-MSFT answered

ACS - Bind chat message actions to a CommunicationUserIdentifier

Hi,

When sending, editing and deleting chat messages of a ChatThreadClient, is it possible to bind a CommunicationUserIdentifier to the action, without adding the user id (as a string) as the senderDisplayName? Something like this:


await chatThreadClient.SendMessageAsync(content, ChatMessageType.Text, identifier);
or
await chatThreadClient.SendMessageAsync(content, ChatMessageType.Text, senderDisplayName, identifier);

instead of:

await chatThreadClient.SendMessageAsync(content, ChatMessageType.Text, senderDisplayName);



I was hoping to extract the id when loading the messages (with chatThreadClient.GetMessages() ) in order to determine how messages are rendered, depending on if they were typed by others, or the currently logged in user. E.g. in MS Teams, where messages by others are a bit to the left, while messages by me are to the right.

Using senderDisplayName as intended is unfortunately not sufficient enough, as I want the message senders to be able to have the same display names, while being perceived as different users. Currently, I've solved this by using the id of a ChatParticipant as the senderDisplayName, saving the id and name of a ChatParticipant in a separate lookup table,. Then I look up the name in the table using the id. However, this hack trickles down and causes issues elsewhere in my application. Such as deleting a user (removing them from the lookup table) and then not having a way of de-coding the id stored in the senderDisplayName

Specifications
Windows 10,
.Net C#
Azure.Communication.Chat v1.0.1
Azure.Communication.Identity v1.0.1

Kindly,
Isak

azure-communication-services
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

brtrach-MSFT avatar image
1 Vote"
brtrach-MSFT answered

@IsakEngstrm-2613 Thank you for your question.

Unfortunately, this would be an expected behavior as ACS does not handle any mapping of the ID and the identity token that is used.

We have gone ahead and shared this as feedback with the product group but for now they did not have any workaround. At this time, this is a hard limitation due to the product design.

Please let us know if there are further questions or concerns and we would be happy to address them.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.