Skip to content

Can't send message with type ChatMessageType.ParticipantAdded #43207

Open
@ranouf

Description

@ranouf

Library name and version

Azure.Communication.Chat 1.1.1

Describe the bug

Same as this bug:
#32623

I create a new ChatThread
```
public async Task CreateChatThreadAsync(string topic, IDictionary<string, string> participants, string accessToken)
{
var client = GetChatClient(accessToken);

        var response = await client.CreateChatThreadAsync(
            topic,
            participants.Select(participant =>
                new ChatParticipant(
                    CommunicationIdentifier.FromRawId(participant.Key)
                )
                {
                    DisplayName = participant.Value
                }
            )
        );
        var result = response.Value.ChatThread.Id;
        return result;
    }
        
        
        then I try to send a message (like propose in the sample there: https://github.com/microsoft/BotFramework-WebChat/tree/master/samples/04.api/a.welcome-event)
        ```

                public async Task<string> SendNewParticipantAddedAsync(
            string accessToken,
            string threadId
        )
        {
            var client = GetChatClient(accessToken);
            var chatThreadClient = client.GetChatThreadClient(threadId);

            var response = await chatThreadClient.SendMessageAsync(
                @"{
                    name: 'webchat/join',
                    value: {  }
                }",
                ChatMessageType.ParticipantAdded
            );
            var result = response.Value.Id;
            return result;
        }

Then i have this issue:

An error occurred while writing to logger(s). (Input string was not in a correct format.) (Input string was not in a correct format.) (Input string was not in a correct format.)'

FormatException: Input string was not in a correct format.

Expected behavior

it should not throw an exception and the message should be sent as expected

Actual behavior

i have this issue:

An error occurred while writing to logger(s). (Input string was not in a correct format.) (Input string was not in a correct format.) (Input string was not in a correct format.)'

FormatException: Input string was not in a correct format.

Reproduction Steps

I create a new ChatThread
```
public async Task CreateChatThreadAsync(string topic, IDictionary<string, string> participants, string accessToken)
{
var client = GetChatClient(accessToken);

        var response = await client.CreateChatThreadAsync(
            topic,
            participants.Select(participant =>
                new ChatParticipant(
                    CommunicationIdentifier.FromRawId(participant.Key)
                )
                {
                    DisplayName = participant.Value
                }
            )
        );
        var result = response.Value.ChatThread.Id;
        return result;
    }
        
        
        then I try to send a message (like propose in the sample there: https://github.com/microsoft/BotFramework-WebChat/tree/master/samples/04.api/a.welcome-event)
        ```

                public async Task<string> SendNewParticipantAddedAsync(
            string accessToken,
            string threadId
        )
        {
            var client = GetChatClient(accessToken);
            var chatThreadClient = client.GetChatThreadClient(threadId);

            var response = await chatThreadClient.SendMessageAsync(
                @"{
                    name: 'webchat/join',
                    value: {  }
                }",
                ChatMessageType.ParticipantAdded
            );
            var result = response.Value.Id;
            return result;
        }

Environment

.net 6.0

	<PackageReference Include="Azure.Communication.Chat" Version="1.1.1" />
	<PackageReference Include="Azure.Communication.Identity" Version="1.2.0" />

Metadata

Metadata

Assignees

No one assigned

    Labels

    ClientThis issue points to a problem in the data-plane of the library.CommunicationService AttentionWorkflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions