Collaborate Chat API using Data Action

Hi Team,

I am trying to use "/api/v2/chats/users/{userId}/messages" from Genesys Cloud Data Actions.

It is giving me an error - "REST call for action execute failed. Message: Request to backend service failed. Response from web service: {"message":"user not found XXXXXXX","code":"not.found","status":404, ".................}

Looks like it is requiring User Context. Is there a way I can execute it through data actions and use it in the flow ? Thanks..!!

Hi,

If the user does exist and you are still getting a 404, make sure your client has the required permissions and scope for the endpoint:

Best

Hi,

Thanks for your response.
I am using Genesys Cloud Data Actions with "Client Credentials" grant type and my Oauth has required permissions. Can we explain me what is mean by "user does exist" ?

Thanks.!!

The userId parameter must match a valid user in your org.

yeah that is correct user id I am using. It saying "OAuth" user id not found. Thanks..!!

No, API endpoints that require a user context cannot be used via data actions since data actions can only use client credentials. I assume the user ID in the error message is your oauth client ID, correct? If so, please report this as a bug with Genesys Cloud Care because the API endpoint is failing to check for client credentials; it should be returning a 400 using the not.a.user error code for this scenario.

Thank you Tim !!

"No, API endpoints that require a user context cannot be used via data actions since data actions can only use client credentials." - Any other alternate way ? like using web service data actions etc.. ?

No, Architect is a server-side service with no UI at runtime and there is no ability for a user to complete an OAuth flow in the context of Architect handling a conversation. You can request new features, such as making this endpoint available to client credentials, and share your use case at https://genesyscloud.ideas.aha.io/.

However, if you by chance mean you're using this data action from a script, you can do this if you build a web app to embed in the script and invoke the API endpoint from your web app without using a data action. Your web app can complete an OAuth flow in the context of the user that's handling the conversation (e.g. implicit grant) then make any API requests it likes as that user.

Thanks for your detailed explanation Tim. From the API explorer is there a way we can find what are the api required user context ? Thanks..!!

Unfortunately, this is not something that's documented in a standard way. Some endpoints may mention it in the description. Some endpoints document the not.a.user error code in the responses. Some endpoints, like this one, don't document the caveat. As a tip for troubleshooting, if you see error messages about users and the ID is your OAuth client ID, that means the endpoint requires a user context but has a bug that it's not checking for client credentials.

Here's some ideas to vote on:

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