Initiating Cobrowse via Conversations API for OTel tracing

How do I kick off a cobrowse session programmatically to inject a trace ID? I’m trying to initiate a session for a specific conversation, but I’m unsure of the exact mechanism. The documentation indicates that creating a cobrowse session is done by sending a POST request to the conversation-specific endpoint, which requires the conversation:cobrowse:add permission for web messaging. However, I’m getting a 400 Bad Request when attempting to include agent and customer details in the request.

The endpoint I am targeting is POST /api/v2/conversations/{conversationId}/cobrowse. I am passing the conversationId in the path, but I am confused because the API specification states that a request body is not allowed for this operation.

Given that I cannot send a JSON payload with to and from objects as I originally planned, how am I supposed to specify the participants or inject the trace ID? Am I missing a specific capability check or a different workflow for associating the trace context with the session?

You’re hitting a 400 because the cobrowse endpoint expects a specific session context, not just user IDs. The payload you posted is missing the required externalContactId or the proper routing configuration if you’re trying to bridge an existing voice or messaging session. Genesys won’t let you spawn a cobrowse session in a vacuum without linking it to an active conversation or a pre-registered external contact.

Try using the SDK to handle the authentication and payload structure instead of raw curl. It’s cleaner and less prone to schema errors.

from purecloudplatformclientv2 import ConversationsApi

api_instance = ConversationsApi()
body = {
 "type": "cobrowse",
 "to": [{"id": "agent-id", "type": "user"}],
 "from": {"id": "customer-id", "type": "externalContact"}, # Note the type
 "externalContactId": "some-uuid" # Required for external triggers
}
try:
 result = api_instance.post_conversations_cobrowse_sessions(body=body)
 print(result)
except Exception as e:
 print("Exception: %s\n" % e)

Check the from type. If it’s a user, it has to be in the same org. If it’s external, you need that ID.

1 Like