Open Messaging API 400 Bad Request when injecting OTel trace context into quick replies

We’re trying to stitch distributed tracing into our Genesys Cloud webchat interactions. The goal is to inject an OpenTelemetry trace ID into the metadata of every quick reply sent via the Open Messaging API. The idea is to correlate the frontend chat session with the backend Data Action execution that generates the response.

I’m hitting a 400 Bad Request when the payload includes the custom trace_id field in the metadata object. The endpoint is POST /api/v2/conversations/messaging/external/contacts/{contactId}/messages. The docs say metadata is a generic object, but it seems to reject unknown keys.

Here’s the payload I’m sending:

{
 "externalMessageId": "msg-123",
 "text": "Here are your options",
 "quickReplies": [
 {
 "title": "Check Order",
 "action": "POST",
 "url": "/api/v2/external/callback",
 "metadata": {
 "trace_id": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01"
 }
 }
 ]
}

The error response is generic:

{
 "code": "bad_request",
 "message": "Invalid input",
 "errors": [
 {
 "code": "invalid_field",
 "message": "The field 'metadata.trace_id' is not allowed."
 }
 ]
}

I’ve tried moving the trace context to the root level of the message object, but that gets stripped out on the way to the client. I also tried using the customAttributes field on the contact, but that doesn’t propagate to the specific quick reply action.

Environment:

  • Genesys Cloud API v2
  • Python 3.9 with genesyscloud-python SDK
  • OpenTelemetry SDK 1.21.0
  • Web Messaging SDK 3.0

Is there a whitelist for metadata keys, or is there a standard way to pass custom context without hitting validation errors? We can’t modify the Data Action to return structured JSON because the client expects standard quick replies.