I’m trying to send a canned response to a Genesys Cloud chat session using the C# SDK. The agent selects a canned response from a dropdown, and I need to push that text into the active conversation programmatically.
I found the PostConversationMessage endpoint in the docs. I’m constructing the request body like this:
var messageRequest = new ConversationMessageCreateRequest
{
Message = new ConversationMessageText
{
Text = "Thank you for contacting support."
},
To = new List<ConversationParticipant>
{
new ConversationParticipant { Id = chatSession.ParticipantId }
}
};
var response = await client.ConversationsApi.PostConversationMessageAsync(chatId, messageRequest);
The call returns a 200 OK, but the message never shows up in the chat window for the agent or the customer. I checked the conversation history via the API and the message is missing there too. Am I missing a specific participant ID or role? The chatId is definitely correct since other API calls work on it. I’ve also tried setting the From participant to the agent’s ID, but that throws a 403 Forbidden error saying I can’t impersonate the agent. What’s the correct way to inject this text?