I’m trying to send a canned response during an active chat interaction using the Genesys Cloud Conversations API. The goal is to inject our OpenTelemetry trace ID into the message metadata so we can correlate the bot response with the upstream Data Action that triggered it.
I’m hitting POST /api/v2/conversations/chat/{conversationId}/messages with the following payload:
{
"text": "Here is the canned response content.",
"type": "text",
"metadata": {
"traceId": "0af7651916cd43dd8448eb211c80319c",
"spanId": "b7ad6b7169203331"
}
}
The request returns a 201 Created, but the trace ID doesn’t appear in the message object when I fetch it later via GET /api/v2/conversations/chat/{conversationId}/messages. It seems like the metadata field is being stripped or ignored for canned responses. I’ve checked the API docs, and while metadata is supported for custom messages, canned responses might have specific restrictions.
Also, I’m noticing that if I omit the metadata field entirely, the message sends fine, but without the trace context, my distributed tracing pipeline breaks. I’ve tried adding the trace ID as a custom header (X-Trace-Id), but that gets dropped by the API gateway, which makes sense since it’s not a standard header for this endpoint.
Is there a way to attach trace context to a canned response without using metadata? Or is there a different endpoint I should be using? I’ve also considered using the sendTextMessage method in the Python SDK, but that doesn’t seem to support metadata either.
Any insights would be appreciated.