Olá Yonetsu,
Caso interessante. Concordo com o Phaneendra que o principal desafio aqui não é necessariamente a API, mas o contexto de autenticação.
Eu provavelmente evitaria utilizar uma Function/Data Action diretamente para originar a chamada de saída. Como operações de criação ou manipulação de conversas dependem de contexto de usuário, um token Client Credentials utilizado por uma integração de backend não representa o agente que pressionou o botão.
Uma arquitetura que eu avaliaria seria manter o botão dentro do Script do Genesys Cloud, mas utilizá-lo para acionar/abrir uma pequena aplicação externa autenticada com o contexto OAuth do próprio agente, utilizando Authorization Code + PKCE. Essa aplicação poderia então executar o POST /api/v2/conversations/calls em nome do usuário autenticado.
Também validaria cuidadosamente o comportamento relacionado ao estado do agente e ao ACW, pois iniciar uma nova interação enquanto o agente ainda está finalizando o trabalho pós-chamada pode trazer outras considerações operacionais dependendo da configuração.
Caso a necessidade de negócio seja essencialmente "retornar a ligação para esse cliente", eu também avaliaria se o Callback nativo do Genesys Cloud não seria uma abordagem mais adequada. Scripts já suportam cenários de Callback e, dessa forma, a interação permanece dentro do modelo de ACD/fila, em vez de gerar uma chamada outbound direta.
Então vejo dois caminhos possíveis:
1. Ligação imediata pelo mesmo agente → Script + aplicação/API autenticada no contexto do usuário.
2. Retorno operacional → Callback nativo do Genesys Cloud.
Fiquei curioso para saber qual abordagem vocês acabarão implementando.
__________________________________________________________________________________________________________________________________________________________________
Hi Yonetsu,
Interesting use case. I agree with Phaneendra that the main challenge here is not necessarily the API itself, but the authentication context.
I would probably avoid using a Function/Data Action directly to originate the outbound call. Since operations such as creating or manipulating a conversation require a user context, a Client Credentials token used by a backend integration would not represent the agent who clicked the button.
One architecture I would consider is keeping the button inside the Genesys Cloud Script, but using it to trigger/open a small external application authenticated with the agent's user OAuth context (Authorization Code + PKCE). That application could then call POST /api/v2/conversations/calls on behalf of the authenticated user.
I would also validate the agent state/ACW behavior carefully, because initiating another interaction while the agent is still completing ACW may introduce additional operational considerations depending on the configuration.
If the business requirement is essentially "call this customer back", I would also evaluate whether a Genesys Cloud Callback could be a more native approach. Scripts already support callback scenarios, and that would keep the interaction within the ACD/queue model instead of creating a direct outbound call.
So I see two possible approaches:
1. Immediate call by the same agent → Script + user-authenticated application/API.
2. Operational callback → native Genesys Cloud Callback.
I would be interested to know which approach you end up implementing.
------------------------------
Matheus Mendonca
------------------------------