I`m trying to make an auto-answer application that automatically accepts interactions on behalf of a agent.
The idea is to deny an agent the possibility to decline a message interaction.
To do so I`m using the Genesys notification API to subscribe to users' topics, get notified when an interaction is assigned to this user, and make a patch request on /api/v2//conversations/{id}/participants/{participantId} with body { state: connected }.
it works when I use the agent's credentials, but I need to do it using application integration OAuth credentials.
But with OAuth credentials, I get bad requests response that tell me I`m not authorized to update this specific conversation attribute ( state).
So I wondering if this specific API request only works for the user session and is not available to third-party applications.
Could you help me confirm that this approach is doable?
Unfortunately, I don't think this approach is doable.
Interacting with a conversation is usually limited to active participants of the conversation.
That's the case with voice to dial or to answer/hold/resume a call, with webchat (mediaType = chat) to answer or to send messages, ...
So it means you must use an API access token related to a user context (token obtained using OAuth Token Implicit Grant, OAuth Authorization Code Grant, SAML2 Bearer Grant) and the associated user must be an active participant of the conversation.
If you are trying to send this API request using a user context token (of a user who is not an active participant), or using a server context token (OAuth Client Credentials Grant), this API request will likely fail.
So you would need to achieve this with a client-side integration (custom webapp in Genesys Desktop - using OAuth Token Implicit Grant).
The user would have to select the custom webapp at the beginning of his shift (to load/start the webapp).
See Set up a Client Application integration and Client Apps
Or using an OAuth Auth Code flow - asking the users to login via a webpage at the beginning of their shift - passing auth code to your server and getting/storing access token (user context) .