I need to close a Web Messaging conversation from our backend service. We are building a custom integration where the frontend doesn’t use the standard Genesys Cloud widget. Instead, we handle the guest creation and message sending via our own Node.js server.
The issue is that the session stays open indefinitely. I can’t find a clear API endpoint to terminate the session server-side. The documentation mentions the widget has a destroy() method, but that’s client-side code. We don’t have access to that from the backend.
Here is the current flow:
- We create a guest using
POST /api/v2/webmessaging/guests. - We send messages using
POST /api/v2/webmessaging/guest/messages. - The agent responds via the PureCloud interface.
- When the agent ends the chat, the session remains active on our side. We need to send a signal to the platform to close it.
I tried sending a DELETE request to /api/v2/webmessaging/guests/{guestId}, but that returns a 405 Method Not Allowed.
DELETE /api/v2/webmessaging/guests/12345678-1234-1234-1234-123456789012
I also checked the POST /api/v2/webmessaging/guest/messages endpoint. I thought maybe sending a specific message type or payload would trigger the closure. The payload looks like this:
{
"guestId": "12345678-1234-1234-1234-123456789012",
"message": "System: Closing session"
}
This just sends another message. It doesn’t close the session.
Is there a hidden endpoint? Or do I need to use the Platform SDK’s WebMessagingApi in a specific way? The SDK docs are sparse on session lifecycle management for headless implementations. We’ve been stuck on this for two days. The metrics are getting skewed because the sessions don’t end properly.