Hey folks,
We’re trying to build a quick re-engagement flow for our WFM team. The idea is to send a proactive notification to a customer who had a web messaging session with us yesterday, asking if they need anything else.
I found the Guest API endpoint /api/v2/conversations/messaging/messages and assumed I could just POST a message to the conversation ID from the previous session. I’m using Python with requests.
Here is what I’m sending:
import requests
headers = {
'Authorization': f'Bearer {access_token}',
'Content-Type': 'application/json'
}
payload = {
"from": {
"id": "bot-id-from-our-system",
"name": "WFM Bot"
},
"to": [
{
"id": "previous-customer-guest-id"
}
],
"text": "Hi, just checking in. Did you get help with your schedule?"
}
response = requests.post(
'https://api.mypurecloud.com/api/v2/conversations/messaging/messages',
headers=headers,
json=payload
)
print(response.status_code)
print(response.text)
The call returns a 400 Bad Request. The error body says:
{
"errors": [
{
"message": "The guest ID provided is not valid for this conversation.",
"code": 400
}
]
}
I thought the Guest ID was persistent across sessions? Or do I need to use a different endpoint for proactive notifications? I tried using the guestId from the original conversation history, but it still fails.
Is there a specific way to format the to field for a previous guest? Or am I missing a step to re-authenticate the guest session before sending?