Genesys Cloud - Main

 View Only

Sign Up

Expand all | Collapse all

Bulk Assignment of Users to a Group

  • 1.  Bulk Assignment of Users to a Group

    Posted 7 days ago

    Hi everyone,

    Is there a way to bulk-assign users to a group in Genesys Cloud without adding them one by one?

    I considered using membership rules based on department or title, but these attributes are not configured for our users.

    Is there another method to automate this assignment, perhaps through the API or another bulk tool?

    Thanks in advance for your help!


    #Implementation
    #Telephony
    #Other

    -------------------------------------------


  • 2.  RE: Bulk Assignment of Users to a Group

    Posted 7 days ago

    Hello Mostafa, 

    There are a couple of ways to do this. Using the Genesys Cloud API, Genesys Cloud CLI (command line interface), profile tags with membership rules and Genesys bulk skills admin app (which I believe is needs to be done through professional services team). 

    For your certain scenario I recommend using the API, since you don't have membership rules for the users. 

    The API you will use is PATCH /api/v2/scim/groups/{groupId}. 

    Hope that helps!



    ------------------------------
    Cameron
    Online Community Manager/Moderator
    ------------------------------



  • 3.  RE: Bulk Assignment of Users to a Group

    Posted 7 days ago
    I recommend using SSO-SCIM integration where provisioning from AD to Genesys is done.
     
    Basically, you will have groups 1, 2, 3...etc.
     
    In AD, you need to have the same group(same name), 1, 2, 3...etc.
     
    When the user is created in AD and added to that group (which is standard, it's always necessary to create the user and add a group in AD), it will automatically be created in Genesys, already in the group where that group will already be in a queue.
    You can even include direct permissions/roles within the group.


    ------------------------------
    Kaio Oliveira
    GCP - GCQM - GCS - GCA - GCD - GCO - GPE & GPR - GCWM

    PS.: I apologize if there are any mistakes in my English; my primary language is Portuguese-Br.
    ------------------------------



  • 4.  RE: Bulk Assignment of Users to a Group

    Posted 7 days ago

    In the past I used the endpoint POST /api/v2/groups/{groupId}/members, which allows you to add 50 members at a time.

    This is the code I wrote:

    import * as platformClient from 'purecloud-platform-client-v2';
    import console from 'console';
    import { chunk } from 'lodash';
    
    const groupId = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx';
    const userIdsAssign = [
      // LIST OF USER IDS HERE
      'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx',
    ];
    
    (async () => {
      const {
        GENESYS_REGION,
        GENESYSCLOUD_OAUTHCLIENT_ID,
        GENESYSCLOUD_OAUTHCLIENT_SECRET
      } = process.env;
    
      if (!GENESYS_REGION || !GENESYSCLOUD_OAUTHCLIENT_ID || !GENESYSCLOUD_OAUTHCLIENT_SECRET) {
        throw new Error('Environment variable not set');
      }
    
      const apiClient = platformClient.ApiClient.instance;
    
      apiClient.setEnvironment(GENESYS_REGION);
      await apiClient.loginClientCredentialsGrant(
        GENESYSCLOUD_OAUTHCLIENT_ID,
        GENESYSCLOUD_OAUTHCLIENT_SECRET,
      );
    
      const userIds = chunk(userIdsAssign, 50);
    
      const groupsApi = new platformClient.GroupsApi();
      for (const chunk of userIds) {
        const response = await groupsApi.postGroupMembers(groupId, {
          memberIds: chunk,
        });
        console.log(response);
      }
    })().catch((e) => {
      throw e;
    });
    



    ------------------------------
    Lucas Woodward
    Winner of Orchestrator of the Year, Developer (2025)

    LinkedIn - https://www.linkedin.com/in/lucas-woodward-the-dev
    Newsletter - https://makingchatbots.com
    ------------------------------



  • 5.  RE: Bulk Assignment of Users to a Group

    Posted 6 days ago

    Hi Lucas, many thanks for this code, do you know how I can use it within Genesys ? 



    ------------------------------
    Mostafa OUDDERHEM
    Ingénieur
    ------------------------------



  • 6.  RE: Bulk Assignment of Users to a Group

    Posted 6 days ago

    Sorry, I should have clarified that my script is TypeScript, which you have to run with Node.js locally on your machine.

    To run it you will need to start by installing npm.

    Then open your Command Prompt and:

    1. Create a project folder and init                                                                                                                                  

    mkdir group-assign && cd group-assign
    npm init -y
                                                                                                                                                                                       
    2. Install dependencies
    npm install purecloud-platform-client-v2 lodash
     
    3. Save the script as assign-members.ts
     
    4. Set environment variables for an OAuth Client you'd have to create
    export GENESYS_REGION=mypurecloud.com
    export GENESYSCLOUD_OAUTHCLIENT_ID=your-client-id
    export GENESYSCLOUD_OAUTHCLIENT_SECRET=your-client-secret
     
    5. Run it
    npx tsx assign-members.ts


    ------------------------------
    Lucas Woodward
    Winner of Orchestrator of the Year, Developer (2025)

    LinkedIn - https://www.linkedin.com/in/lucas-woodward-the-dev
    Newsletter - https://makingchatbots.com
    ------------------------------



  • 7.  RE: Bulk Assignment of Users to a Group

    Posted 6 days ago
    Edited by Phaneendra Avatapalli 6 days ago

    Hi Mostafa, 

    In our environment, I implemented this using the Groups API with an OAuth client (Client Credentials grant). A lightweight Google Apps Script pulls the desired membership from a spreadsheet and synchronises it with Genesys automatically (adding and removing users as needed).

    We still use this approach today, as we regularly update group memberships and needed a reliable way to avoid manual changes (add & remove). Trigger are put in Gscript which does the group membership automatically for us.

    I shared the use case here in case it helps:
    https://community.genesys.com/discussion/use-case-automating-genesys-group-membership-management






    ------------------------------
    Phaneendra
    Technical Solutions Consultant
    Monash University
    Australia
    ------------------------------



  • 8.  RE: Bulk Assignment of Users to a Group

    Posted 6 days ago

    Hi Mostafa,

    This may also be a use case question for Genesys Cloud Copilot to do when it arrives.



    ------------------------------
    Richard Chandler
    Connect
    ------------------------------



  • 9.  RE: Bulk Assignment of Users to a Group

    Posted 5 days ago

    Totally agree, @Richard Chandler. According to this thread, GC Copilot won't be able to handle Group management when initially released (GA), but would love to see it come after GA.



    ------------------------------
    Brian T. Jones | Ascension | Senior Specialist - Technology | Colossians 3:23-24
    ------------------------------



  • 10.  RE: Bulk Assignment of Users to a Group

    Posted 6 days ago

    Try this: https://help.genesys.cloud/articles/add-people-csv-file-import/



    ------------------------------
    Rial Coleman
    Sr. VoIP Administrator
    District of Columbia Water and Sewer Authority
    ------------------------------



  • 11.  RE: Bulk Assignment of Users to a Group

    Posted 6 days ago

    As far as I know and have tested, it's not possible to add groups via bulk import.



    ------------------------------
    Kaio Oliveira
    GCP - GCQM - GCS - GCA - GCD - GCO - GPE & GPR - GCWM

    PS.: I apologize if there are any mistakes in my English; my primary language is Portuguese-Br.
    ------------------------------



  • 12.  RE: Bulk Assignment of Users to a Group

    Posted 6 days ago
    Edited by Simon Brown 6 days ago

    Others have mentioned good choices.

    Depends on your level of tech skills as well.

    I found the GC command line tool a great admin companion for things like this.

    For example, to add members to a group you can use a single command passing in the json payload

     gc.exe groups members add 

    suffix with --help will give you details about API so you can refer to documentation.

    Add members

    Usage:
      gc groups members add [groupId] [flags]

    Operation:
      POST /api/v2/groups/{groupId}/members


    Note: The 'version' value from the command input will be ignored and the latest version value will be retrieved from the API instead

    and it provides link so you can see API and what it expects Groups APIs

    you can use the --file parameter to provide the json payload for the command, which you can derive from the API link

    e.g.

    {
      "version": 9,
      "memberIds": [
        "49e0bec5-1d5c-487f-a365-f8bd2f8c8095",
        "cbfc33f4-a6d8-4292-bfda-3a87beb83c99",
        "c2072ab6-427e-4040-91c9-ef6b0df49289" ]

    }
     

    If you have coding/scripting skills you could put in powershell/python and take the userId list from something like csv file.



    ------------------------------
    Simon Brown
    Maintel Europe Limited
    Senior Applications Consultant
    ------------------------------



  • 13.  RE: Bulk Assignment of Users to a Group

    Posted 6 days ago
    Edited by Brian Jones 5 days ago

    @Mostafa OUDDERHEM - Funny you mention the Department field. When we provision our users we add the Group name to their Department field that way we can use the inclusion rule you're referring to. You could do a one-time bulk import of all existing user accounts and include the respective Group names in the Department field when you do so. That said, if you're planning to use a Group for more than "user organization purposes" (e.g. skill expression/role assignment/call purposes), Groups won't let you use inclusion rules.

    I love all of the developer-style ideas proposed here, but if that's too far out of your area of expertise, I would make sure you vote for and follow this idea to get a bulk importing of users into Groups added natively in the UI: https://genesyscloud.ideas.aha.io/ideas/AMUGM-I-30. Although it's marked as "Future Consideration", at least it's not in "Will Not Implement" 🤷‍♂️



    ------------------------------
    Brian T. Jones | Ascension | Senior Specialist - Technology | Colossians 3:23-24
    ------------------------------