Closing Web Messaging session from backend C# service

Hey folks. I am working on a custom agent desktop in C# and we need to programmatically end a Web Messaging session from our backend service. The agents use our app to handle the chat, but once they click “End” in our UI, we send a request to our .NET Core API to clean things up.

I am trying to figure out the right API call to make. I see there is a conversation update endpoint. I tried sending a PUT request to /api/v2/conversations/messaging/{conversationId}. I set the state to closed and the wrapupCode in the JSON body.

Here is the payload I am sending:

{
 "state": "closed",
 "wrapupCode": {
 "id": "12345-67890"
 }
}

The call returns a 200 OK. The conversation status changes in the Genesys Cloud admin view. But the guest side of the chat window stays open. The little typing indicator is still there. The guest can still type messages. It does not look closed to them.

I read somewhere that you might need to send a specific message or event to the guest. Is there an API call to push a “session ended” event to the Web Messaging guest SDK? I do not see a direct “close guest session” endpoint in the docs.

I also tried sending a message with type: system and text: Session ended. That posts the message, but the chat window does not close. The guest is still connected.

We are using the latest Web Messaging embed code. I want the guest’s chat window to actually disappear or show a closed state. Right now it just hangs there.

Any ideas on what I am missing? Do I need to use the Notification API to trigger something on the client side? Or is there a different property in the conversation update payload? I have been staring at the docs for an hour and I am not seeing it.