Genesys Cloud - Developer Community!

 View Only

Sign Up

  • 1.  Using CLI & trying to use conversations/calls/update

    Posted 10-14-2025 08:20

    Hi,

    I'm trying to automate a process that causes us some issues. We upload new outbound campaign contact lists each day. If the campaign doesn't stop correctly the night before, the upload process fails. This is usually because an agent still has a preview interaction open - so the campaign gets stuck in "Stopping" mode, and we use "Force Stop" (manually) on the campaign.

    I want to instead schedule a Powershell script that will use the GC CLI to loop through our campaigns and if necessary, stop them.

    It seems that there is no way to directly force stop a campaign from the API - just using outbound campaigns stop create <id> will just put them into the "Stopping" state, the same as always.

    So, instead, the workaround would be to get the list of active interactions on the campaign, then call conversations calls update <id> and change the status to Disconnected, so the campaign can then be stopped.

    However, I'm authenticating the CLI through Client Credentials, so if I try to update the conversation status, I get:

    {
      "message": "This request requires a user context. Client credentials cannot be used for requests to this resource.",
      "code": "not.a.user",
      "status": 400,
      "contextId": "fb78394d-30d7-4e08-abdb-008344656a3b",
      "details": [],
      "errors": []
    }

    My question is, is there no way round this? The "expected" solution is to have the CLI launch a login page and log in to authenticate - which then defeats the purpose of automating it through the CLI. This is meant to run unmanaged to alleviate work for us (for me).


    #PlatformCLI

    ------------------------------
    James Dunn
    Telecoms Specialist
    ------------------------------


  • 2.  RE: Using CLI & trying to use conversations/calls/update

    Posted 10-14-2025 22:02

    Hi @James Dunn

    You might want to check this article about using Implicit Grant with the Genesys Cloud CLI: https://developer.genesys.cloud/blog/2022-02-11-cli-implicit-login/.
    It explains how to log in with user context for unattended CLI use.

    See if that helps with your case.



    ------------------------------
    Luiz Rosa
    Full stack developer
    ------------------------------



  • 3.  RE: Using CLI & trying to use conversations/calls/update

    Posted 10-16-2025 10:08

    Thanks Luiz, I did check that, but it still ends up reverting to requiring a browser to pop and log in.

    But, good news, I did find out how I can force_stop the campaign from the CLI using non-user context APIs. So, my issue is resolved anyway.

    Thanks.



    ------------------------------
    James Dunn
    Telecoms Specialist
    ------------------------------