I am using data actions to send an email to customer for one of the use cases. Getting below error:
I tried both the ways Genesys Cloud Data actions and web service data actions. Same issue in both the ways.
{
"message": "The request could not be understood by the server due to malformed syntax.",
"code": "bad.request",
"status": 400,
"messageParams": {},
"contextId": "XXXXXXXXXXX",
"details": [
{
"errorCode": "ACTION.REMOTE_ENDPOINT"
}
],
"errors": [
{
"message": "REST call for action execute failed. Message: Request to backend service failed. Response from web service: {"message":"This request requires a user context. Client credentials cannot be used for requests to this resource.","code":"not.a.user","status":400,"contextId":"XXXXXXXXX","details":[],"errors":[]} [XXXXXXXXXXX]",
"code": "BAD_REQUEST",
"status": 400,
"messageParams": {},
"details": [],
"errors": []
}
]
}
You can only use client credentials with data actions; client credentials don't have a user context. You can't use API endpoints that require a user context in data actions (flows or scripts).
Nothing is broken. If you want to make API requests that require a user context, you must build an application that authorizes users using any of the supported OAuth grants that aren't client credentials. Which grant you choose depends on the architecture of the application you're going to build. You can read more about the different grant types and Genesys Cloud authorization here: https://developer.genesys.cloud/authorization/platform-auth/.
That oauth client will only work if you're publishing an app you wrote on the domain login.usw2.pure.cloud, which you aren't. You would use the URL of the web app you developed as your redirect URI.
As I mentioned in my first post, I want to use data action to send email not external application. We don't have any external application. I want to call this data action based on some business logic in architect.
My previous suggestion is the only way to use that API endpoint. If you want to send an outbound email on behalf of a queue, you're using the correct endpoint and it requires a user context, which in turn requires you to build an end-user application where agents authorize the app so it can send outbound emails on their behalf.
If you're misusing the API endpoint as a general purpose outbound mail server and aren't trying to create an outbound conversation in Genesys Cloud, you should integrate with a general purpose outbound email provider of your choosing that you can invoke via a web services data action. You can build a middleware application to integrate between the data action and your email provider if the email provider doesn't have an endpoint that meets the criteria for a data action. You can find documentation for web services data actions here: About the web services data actions integration - Genesys Cloud Resource Center.
Tim - let me explain my use case, I have a custom solution for Genesys Cloud Surveys, I would like to send some kind of notification/information to supervisor if score is <50 or something. Is there a way we can achieve this ?