We are trying to implement a proactive outreach feature for our Central time zone support queue. The idea is that if an agent sees a high adherence gap, they can trigger a message to a customer who was previously in a web messaging session but didn’t close it out cleanly.
I’m using the Genesys Cloud Platform SDK for Python. I have the conversation ID and the participant ID. I thought I could just use the post_conversations_messages method to push a text message to that specific participant. Here is the code I’m running:
from platform.client import Client
from platform.models import MessageBody
client = Client.create(...)
body = MessageBody(
content_type='text/plain',
content='Hello, are you still there?'
)
try:
response = client.conversations.post_conversations_messages(
conversation_id='conv-12345',
body=body,
participant_id='part-67890'
)
print(response)
except Exception as e:
print(f"Error: {e}")
The code throws a 403 Forbidden error. The error message says Access denied. You do not have permission to perform this action.
I checked the OAuth scopes for the client I’m using. It has conversation:write and messaging:write. I thought that would be enough to send a message on behalf of the system or the agent. But it’s not working.
Is there a different API endpoint I should be hitting? Or maybe a specific header I need to include to impersonate the agent? I’ve looked at the API docs for /api/v2/conversations/messages but it doesn’t mention anything about proactive messages or required permissions beyond the standard write scope.
Also, I’m not sure if I need to use the Guest API instead. But I don’t have the guest token. I only have the internal conversation ID. How do I get the guest token from the conversation ID to use the Guest API? Or is that even the right path here?
Any help would be appreciated. We’re stuck on this and it’s blocking our adherence workflow update.