How to send a proactive web message to a customer from a previous session?

Hey folks,

I’m trying to figure out how to send a proactive notification or message to a customer who previously had a web messaging session with us. We’re working on improving our WFM adherence and service level metrics by reaching out to customers who abandoned the queue or ended a session without resolution.

I’ve been looking through the Genesys Cloud API docs, and I see there’s a /api/v2/conversations/messages endpoint, but I’m not sure if this is the right one to use for proactive outreach. I also noticed there’s a Web Messaging Guest API, but I’m not sure how to tie it back to a previous session.

Here’s what I’ve tried so far:

import requests

headers = {
 'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
 'Content-Type': 'application/json'
}

payload = {
 "to": [
 {
 "id": "CUSTOMER_ID_FROM_PREVIOUS_SESSION"
 }
 ],
 "text": "Hey, just checking in. Did you need help with your last issue?"
}

response = requests.post(
 'https://api.mypurecloud.com/api/v2/conversations/messages',
 headers=headers,
 json=payload
)

print(response.status_code)
print(response.json())

When I run this, I get a 400 Bad Request error with the following message:

{
 "message": "Invalid message recipient",
 "code": "bad.request",
 "status": 400
}

I’m not sure if I’m using the right endpoint or if there’s a different way to identify the customer from a previous web messaging session. Does anyone know how to properly send a proactive message to a customer who had a prior session?

Thanks in advance!