Stuck on injecting OTel context into Genesys Notification WebSocket subscriptions.
I am using the Python websockets library to connect to wss://api.mypurecloud.com/api/v2/analytics/conversations/events. I need to propagate the current trace context (traceparent) from my upstream Data Action trigger to the WebSocket handshake so I can correlate inbound events back to the originating span in Jaeger. The standard SDK does not support custom headers on the WebSocket upgrade. Here is my current setup:
import websockets
import asyncio
headers = {
"Authorization": f"Bearer {access_token}",
"Traceparent": trace_context_header # e.g., "00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01"
}
async def subscribe():
uri = f"wss://api.mypurecloud.com/api/v2/analytics/conversations/events?ids={conversation_id}"
async with websockets.connect(uri, extra_headers=headers) as websocket:
async for message in websocket:
process_event(message)
The connection fails with a 401 Unauthorized immediately after the handshake attempt, despite the token being valid for REST calls. Does the Notification API WebSocket endpoint reject custom headers during the HTTP Upgrade phase, or is there a specific query parameter mechanism I am missing to attach correlation IDs without breaking authentication?