Posting to POST /api/v2/conversations/chat/{id}/messages with a canned response payload returns 400 Bad Request. The body looks valid to me:
{ "text": "Thanks for calling", "type": "canned" }
Docs are vague on the exact schema for canned messages. What’s the right structure?
You’re missing the content wrapper. The API expects the text to be nested, not at the root level. Also, type: canned isn’t a standard message type for the POST payload in the way you’re thinking. You usually just send a text message. If you’re trying to trigger a canned response from a bot or external app, you just send the text.
Try this structure:
{
"content": {
"type": "text",
"text": "Thanks for calling"
},
"author": {
"id": "your-agent-id"
}
}
If you’re actually trying to use the Canned Responses feature from the UI, that’s handled via the cannedResponse resource endpoint, not the conversation message endpoint. You fetch the canned response by ID, get the text, and then post it as a standard text message. There’s no magic canned type in the chat message schema.
Check the 400 response body. It usually tells you exactly which field is invalid.