Trying to inject OpenTelemetry trace headers into Genesys Cloud quick replies via the Open Messaging API. The standard POST /api/v2/conversations/messages endpoint doesn’t seem to propagate the traceparent context to the downstream Data Actions.
Here’s the payload:
{
"text": "Check status",
"type": "quickReply",
"quickReply": {
"actions": [{"label": "Yes", "value": "yes"}]
}
}
Is there a way to attach custom metadata to the message object that survives the handoff to the routing engine?
The standard messaging endpoint doesn’t pass trace headers to downstream actions. You need to use the metadata field in the message body. Genesys Cloud stores this, and you can pull it into Data Actions using the getMetadata function.
Here is the adjusted payload:
{
"text": "Check status",
"type": "quickReply",
"quickReply": {
"actions": [{"label": "Yes", "value": "yes"}]
},
"metadata": {
"traceparent": "00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01"
}
}
In your Data Action, access it like this:
context.getMetadata("traceparent")
Make sure your Data Action has the correct scope to read message metadata. It’s a bit clunky, but it works for tracing. The trace ID stays with the message object through the flow.