Getting error in agentless email notification

Hi team,

My client needs to trigger an email when no agents are on queue. To implement this, I decided to go with Agentless email notification.

As a first step, I created a Genesys cloud email domain and created an email address as GenesysCorp@PJITest.pure.cloud.

As a second step , I ran the API https://developer.genesys.cloud/devapps/api-explorer#post-api-v2-conversations-emails-agentless

But I got error as "The request failed with response code: 400. Message: This request requires a non-user context. User token cannot be used for requests to this resource."
Could you please help me to undersatnd why the API is failing?

Regards,
Gowthami R

Hey @Gowthami_R1 may I ask where did you obtain the token you had used in your POST API call?

Hi Gowathami,

The API you are calling must be invoked using a token generated with an OAuth Client Credential. Based on your description it sources you are using a user-based token and the API is rejecting.

Thanks,
John

Gowthami,

You cannot use the API Explorer to execute/test the Agentless Email API. When you are using the API Explorer, it is using a user-context OAuth token that it obtained when you used the 'Add Account' feature, and the agentless email API will not execute under a user-context OAuth client.

If you want to play with that API then can use Postman along with our pre-built Postman collections (https://developer.genesys.cloud/platform/api/postman) to execute that API under a client-credentials OAuth client context.

Alternatively you can setup a Genesys Cloud Data Action (https://help.mypurecloud.com/articles/about-genesys-cloud-data-actions-integration/) that calls that API using a client-credentials OAuth client context as well. You can test out the API using the 'Test' tool in the Data Action UI and once you've got the Data Action functioning to your liking you can then use that Data Action in Architect or an Agent Script.

I hope that helps you make some progress.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.