Adding a Bot to Azure Communication Service Chat Thread using the Microsoft App Id failed

31 Views Asked by At

I would like to add a Chat Bot using a Bot Azure as a participant to our existing Azure Communication Service Chat Thread.

Following the instruction given by Microsoft (https://learn.microsoft.com/en-us/azure/communication-services/quickstarts/chat/quickstart-botframework-integration#start-a-chat-thread-with-the-bot), the code to do that is:

var chatParticipant = new ChatParticipant(identifier: new CommunicationUserIdentifier(id: "<BOT_ID>"))
{
    DisplayName = "BotDisplayName"
};
CreateChatThreadResult createChatThreadResult = await chatClient.CreateChatThreadAsync(topic: "Hello Bot!", participants: new[] { chatParticipant });
ChatThreadClient chatThreadClient = chatClient.GetChatThreadClient(threadId: createChatThreadResult.ChatThread.Id);
string threadId = chatThreadClient.Id;

To get the Bot ID, I need to go Configuration and take the Microsoft App ID: enter image description here

The format is like: 2647dbd1-f3b9-4f55-9990-5b09d5XXXXXX

But when I take a look on our existing Azure Communication Service User Ids it's more like: 8:acs:bdba939d-38ab-4c4f-8415-bb97a4f1d291_0000001d-09bf-5a56-2633-8e3a0dXXXXXX

At first look, this is strange, but maybe it could work ...

But when I try, I always have the same issue:

System.FormatException: Input string was not in a correct format

Where is my mistake? How to be able to add the bot as a participant?

0

There are 0 best solutions below