Invite collaborators to your organization in bulk

Efficiently adding users to your organization across various roles is crucial in streamlining your localization process. This enables you to build a tailored team that can effectively address your specific localization requirements. In this article, we will guide you through the process of adding users in bulk, empowering you to assemble the ideal team for your localization endeavors.

For adding users in bulk to your organization, we have prepared an easy-to-use Python recipe; in a few steps, you can add them to multiple projects and teams across your organization.

Prerequisites

  • For this process, you will need to download the recipe called “Add users to your organization in bulk” from our developer’s hub.

  • The recipe is a Python script, so installing Python on your computer is essential.

  • Create a CSV file to add all the details of the users you want to add to your organization; the structure of this file will be described in the next section.

  • Get your API token.

Structuring of your CSV file

The CSV file should contain some information about your users, and depending on the role you want to assign to them, it should also have some information about the project or team to which they will be added.

You can create this CSV file in any spreadsheet application like Google Sheets or Microsoft Excel; they usually have options to export to CSV files.

Every row in the file will correspond to a single user, and the columns should contain the following information:

  • username: This is a required field; it’s how Transifex will identify the user to add you to the organization. Please respect the upper and lower cases in the characters listed in the username.

  • role: This is a required field; it’s the function you want this user to serve within your organization. For more information about the roles in the Transifex platform, it can have the fo you can read the Understanding User Roles article. The optional values to this field should be all in lowercase; it can be:

    • project maintainer

    • coordinator

    • team manager

    • translator

    • reviewer

  • project_slug: This is an optional field; it’s how Transifex will identify to which project the user will be assigned. It should be added in case you add a project maintainer to any of your projects. Please respect the upper and lower cases in the characters listed in the project’s slug. If you enter your project’s dashboard, you can find your project slug in the URL (https://app.transifex.com/organization_slug/project_slug/dashboard/).

  • team_slug: This is an optional value you should add in case you’re adding a new team manager, a translator, a reviewer, or a language coordinator. You can get your team’s slug from the list teams endpoint.

  • language_code: This is an optional value you should include if you add a language coordinator, translator, or reviewer. More information on language codes is listed in the article Language Codes and Locales.

CSV file example

Let’s say you want to include the following users:

  • User1 will be added as a project maintainer to your project with slug proj_123.

  • User2 will be added as a team manager for your team with slug team_123.

  • User3 will be added as a language coordinator in your team with slug team_456 in language es_MX.

  • User 4 will be added as a translator in your ream with slug team_456 in language es_MX.

Your file should be looking like this:

image

image

Note: Keep in mind you cannot add a language translator or reviewer to a specific language team; you should be sure that there is a language coordinator or add a language coordinator first.

How to use the recipe

To run the recipe, you need to run the following command in your terminal, where recipe.py is the file of the recipe, and users.csv is the file described in the previous section:

python recipe.py users.csv 

Then, the script will ask you to add your API key:
image

Finally, you will need to add your organization slug:
image

Now, the script will start to add the users to your organization, and you will see one of the following messages in the terminal for each one of the users that you want to invite:

  • When adding a project maintainer:
    USERNAME was added to your project PROJECT_SLUG as project maintainer

  • When adding a team manager:
    USERNAME was added to your team TEAM_SLUG as team manager

  • When adding a language coordinator:
    USERNAME was added to your team TEAM_SLUG as coordinator in language LANGUAGE_CODE

  • When adding a reviewer:
    USERNAME was added to your team TEAM_SLUG as reviewer in language LANGUAGE_CODE

  • When adding a translator:
    USERNAME was added to your team TEAM_SLUG as translator in language LANGUAGE_CODE

Errors in this process

In the same file where your recipe is located, the script will create a file called app.log; in this file, you’ll see any error registered in the process of inviting users in bulk.