I’ve been working on a custom agent desktop extension that needs to notify customers via web messaging after their initial session has ended. The goal is to send a proactive message to a guest who previously connected via the Web Messaging SDK. I’m using the Genesys Cloud Guest API to create a new message for an existing conversation.
Here’s the flow I’m implementing:
- Retrieve the conversation ID from our internal DB (it’s a closed web messaging conversation).
- Call
POST /api/v2/conversations/messaging/messageswith the conversation ID and the new message payload. - Expect the message to be delivered to the guest’s browser if they still have the tab open, or stored for later.
The issue is that I keep getting a 409 Conflict error with the message: Conversation is not in a state that allows adding messages. The conversation status is closed. I assumed that since the guest might still have the widget open, we could inject a message. But it seems the API is strict about the conversation state.
Here’s the JSON payload I’m sending:
{
"from": {
"name": "Support Bot",
"id": "bot-id-123"
},
"text": "Is there anything else we can help you with?",
"conversationId": "existing-closed-conversation-id"
}
I’ve checked the docs and it mentions that proactive messages are supported, but it’s unclear if that applies to closed conversations or only open ones. I tried changing the conversation status to open first using PATCH /api/v2/conversations/messaging/conversations/{id}, but that fails with a 400 Bad Request saying the status change is invalid for a closed conversation.
Is there a way to reopen a conversation programmatically to send a notification? Or should I be using a different endpoint, like the Guest API’s sendProactiveMessage? I haven’t found clear examples of that in the SDK docs. Any pointers would be appreciated.