Error when using api/v2/conversations/calls in data action

Hello

I'm trying to use api/v2/conversations/calls in data action (Genesys Cloud Data Actions) ,but it gives me the following error:

"message":"This request requires a user context. Client credentials cannot be used for requests to this resource.","code":"not.a.user","status":400,"

When I use "/callbacks" it works without problem. What is the difference between "/calls" and "/callbacks" in terms of the received error, and why "/calls" is not working?

Thanks in advance

Hello,

Are you talking about GET api/v2/conversations/calls or POST api/v2/conversations/calls?

Regards,

Hello Jerome
thanks for your repply

I'm using POST api/v2/conversations/calls

With this data in api-explorer page I can create a call successfully

{
"callQueueId": "{queueId}",
"callFromQueueId": "{queueId}",
"participants": [
{
"address": "{phoneNumber}"
}
]
}

Hi Carlos,

Data Actions utilize a Client Credential to make requests to the Public API. This credential type is intended for server to server communication and so do not include a user context. Some APIs, especially around call control, require the requester to be part of the conversation in order to modify it. Since client credentials do not have a user, they can not be part of a conversation.

Here are several ideas around this issue:
https://genesyscloud.ideas.aha.io/ideas/DIG-I-1121
https://genesyscloud.ideas.aha.io/ideas/OPAPISDK-I-1
https://genesyscloud.ideas.aha.io/ideas/AMUGM-I-8

Feel free to vote for them / add new use cases / create a new idea if they don't match your situation.

--Jason

1 Like

Hi Jason
I would like to understand better.
The "/call" API needs user context, while with the "/callback" API the error doesn't happen because context isn't necessary?

Regards.

Hello,

Some Platform API endpoints can only be invoked with a user context, some can only be invoked with a server context (e.g. Send AgentLess SMS/OpenMessagig/WhatsApp message, ...), some can be invoked with user or server contexts.
It depends on the API endpoint and what capability is associated with this API endpoint.

POST /api/v2/conversations/callbacks is meant to create a new callback conversation (Schedule a new callback). The callback request in itself does not need to be associated with who has invoked the API endpoint (user or server context). There is just a new callback conversation submitted to the system, scheduled to be activated at a specific time, meant to be waiting in a specific ACD Queue, ... (all of these details being sent in the request's body).
So this API endpoint has been implemented to allow user context or server context to invoke it.

POST /api/v2/conversations/calls is meant to create a new call conversation.
At this time, it is not possible to create a call between a queue and an external number, or between the IVR (Architect Inbound flow) and an external number. Genesys Cloud only allows to create a call between a user's phone and a destination (external number, other genesys cloud user, queue).
The originating party (the user's phone) is derived from the credentials (user context). Genesys Cloud gets the credentials used for this request, sees it is a user context, finds the user associated with this context, and leverages the active phone associated with this user as one of the parties in the call (call made from user's phone to the provided destination).
That's why the request is rejected when used with a server context (not a user - no phone to leverage as caller).

Regards,

1 Like

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