We’re trying to push a compliance greeting through the chat window using the Conversations API. The server returns a 400 bad request every time I hit /api/v2/conversations/chat/messages. The routing team needs the system to auto-send the verified script when the agent joins. I’ve been testing from a local curl script and the error says invalid participant id. We’re using a valid token for US/Eastern routing groups. Here is the exact payload:
{
"conversationId": "conv-8821",
"participantId": "part-4492",
"text": "This chat is recorded for quality assurance.",
"type": "canned"
}
The curl command doesn’t show any auth issues. The endpoint just refuses the participant reference.
Here’s the working payload structure. You’re missing the toParticipantId field inside the message object. The API needs to know who is sending the message, not just who the conversation belongs to.
{
"toParticipantId": "AGENT_PARTICIPANT_ID_HERE",
"text": "This is a compliance greeting.",
"type": "text"
}
Also, you need to grab the actual participant ID from the conversation details first. The conversation ID isn’t enough. Hit GET /api/v2/conversations/chat/{conversationId} to get the list of participants. Find the agent’s ID in that response. Then use that specific ID in the toParticipantId field of your POST request.
Make sure your token has conversation:chat:write scope. If you’re still getting 400s, check the participant status. The agent has to be in connected or ringing state. Can’t send messages to a participant who hasn’t joined yet.