This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.18k
stars
4.54k
forks
source link
Can't send message with type ChatMessageType.ParticipantAdded #43207
public async Task<string> 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;
}
Library name and version
Azure.Communication.Chat 1.1.1
Describe the bug
Same as this bug: https://github.com/Azure/azure-sdk-for-net/issues/32623
I create a new ChatThread
public async Task CreateChatThreadAsync(string topic, IDictionary<string, string> participants, string accessToken)
{
var client = GetChatClient(accessToken);