Anyone know why the cobrowse initiation endpoint is rejecting my payload with a generic 400 error? I am trying to automate session starts for QA audits using PowerShell. The documentation implies a simple POST should suffice, but I cannot get it to stick.
Here is the snippet I am using:
$uri = "https://api.mypurecloud.com/api/v2/conversations/webmessaging/sessions/$sessionId/cobrowse"
$payload = @{
initiator = @{
id = "agentId_123"
type = "agent"
}
}
Invoke-RestMethod -Uri $uri -Method Post -ContentType "application/json" -Body ($payload | ConvertTo-Json) -Headers $authHeader
The token is valid (I can query the session details right before this). The error response is unhelpful:
The request could not be understood by the server due to malformed syntax. Please check the request body format.
I have tried changing the initiator object structure to include name, but it fails the same way. Is there a specific JSON schema requirement for the cobrowse initiation that isn’t documented? I am on PowerShell 7.4.