I’m trying to automate the injection of a canned response into an active chat session using the genesyscloud Terraform provider and a post-deploy script. The goal is to trigger a specific message from a backend service once a certain condition is met in our data layer, bypassing the normal agent typing flow.
I have the conversationId and the participantId for the agent. I’m hitting POST /api/v2/conversations/chats/{conversationId}/messages with the following payload:
{
"text": "Here is the info you requested.",
"to": {
"participantId": "12345678-abcd-1234-abcd-1234567890ab"
}
}
The request returns a 200 OK, but the message never shows up in the chat window for the agent or the customer. I’ve verified the participantId is correct by checking the conversation details endpoint. Is there a specific header or body field I’m missing to make this a visible user message instead of a system event? The docs are a bit sparse on the difference between these message types. I’ve tried adding "type": "user" but that just throws a 400 Bad Request saying the type is immutable.