> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://help.sigmacomputing.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://help.sigmacomputing.com/_mcp/server.

# Member: Onboarding (JavaScript)

> This script automates the onboarding process for a new member by creating them and executing a series of actions in a specific order.

This master script executes several methods required to use the API to add new members to Sigma with the necessary assets and permissions.

Each section of the script has inline comments provided.

Refer to the [Sigma REST API Recipes](https://quickstarts.sigmacomputing.com/guide/developers_api_code_samples/index.html?index=../..index#0) QuickStart for step-by-step instructions.

## Example script

```javascript JavaScript
// masterOnboardingProcess.js
// This script creates a new member by using the manually update memberId from .env and then calling each other script in order
// You must create the new member first, manually using the script in members/create-new.js and paste the returned memberId in .env

// Import necessary scripts
const addMemberToTeam = require('./add-member-to-team');
const grantWorkspacePermission = require('./create-workspace-permission');
const addNewConnectionPermission = require('./create-workspace-permission'); // This line seems incorrect, it should import a different script
const addNewWorkspace = require('./create-workspace');

// Define an asynchronous function to handle the onboarding process
async function onboardNewMember() {
    console.log('Starting the automated part of the onboarding process.');

    try {
        // Assuming addMemberToTeam.js and other scripts use MEMBERID from .env internally
        console.log('Adding member to team...');
        await addMemberToTeam();
        console.log('Member successfully added to team.');

        console.log('Creating a new workspace...');
        await addNewWorkspace();
        console.log('New workspace created successfully.');

        console.log('Granting workspace permission...');
        await grantWorkspacePermission();
        console.log('Workspace permissions granted successfully.');

        console.log('Granting connection permission...');
        await addNewConnectionPermission(); // This line seems incorrect, it should call a different function
        console.log('Connection permissions granted successfully.');

        // Include other steps as necessary
        
        console.log('Onboarding process completed successfully.');
    } catch (error) {
        console.error('An error occurred during the onboarding process:', error);
    }
}

// Execute the function to start the onboarding process
onboardNewMember();
```

## Endpoints used

1. Get authentication token: `${baseURL}/authURL`
2. List recent documents: `${baseURL}/members/${memberId}/files/recents`
3. Get all workbooks: `${baseURL}/workbooks?page=${nextPage}`
4. List users: `${baseURL}/members?page=${page}`
5. Add a new user: `${baseURL}/members`
6. Add a user to a team: `addMemberToTeam` function
7. Grant workspace permission: `grantWorkspacePermission` function
8. Add new workspace: `addNewWorkspace` function
9. Add new connection permission: `addNewConnectionPermission` function