I’m trying to inject a canned response into an active chat session using the Conversations API. We’ve got a Terraform setup managing the canned responses themselves, so the resource exists and is active. But when I hit the send endpoint, it keeps rejecting the payload with a 400 Bad Request.
The endpoint I’m hitting is POST /api/v2/conversations/chat/{conversationId}/messages.
Here’s the JSON I’m sending:
{
"to": [
{
"id": "customer-participant-id-here",
"type": "user"
}
],
"text": "{{canned_response_id}}",
"type": "text"
}
The error response just says Invalid request body. It doesn’t specify which field is wrong. I’ve tried sending the raw text string instead of the ID, which works fine. I’ve also tried adding a from object with my user ID, but that didn’t change anything.
Looking at the docs, it seems like you can reference a canned response by ID in the text field, but maybe that’s only for internal messages? Or am I missing a header? I’m using Python requests to make this call. The auth token is valid since I can send normal text messages without issue.
Is there a different endpoint for triggering canned responses programmatically? Or is the text field strictly for literal strings?