Lab 0 - Automating Retool
Goal
Enterprises that adopt Retool look to automate as much as they can to create consistent onboarding / offboarding experiences. The following lab will focus on using the Retool API and Workflows to demonstrate one automation option.
The following steps require having Administrator permissions. If you do not have these please work with your admin contact.
Instructor creates Retool API Token
- Go to Settings > Retool API > Create new.
- Create a token with the name
onboarding_class_tokenand scope ofUsers ReadandUsers Write. - Select Create token.

- This will display the token.

- Copy the token and move to the next section.
Instructor creates a configuration variable
- Go to Settings > Configuration Variables.
- Specify the name
onboarding_class_config_var, a description, enable Mark variable as secret, and for Values specify a production value equal to the previous access token. - Select Save Changes.

- Configuration variables are then displayed as shown:

Instructor creates a Resource using configuration variable
- Go to Resource > REST API
- Provide a name of
Retool_API - Update the URL to use the following value:
- Update the authentication to use a token and specify the value using the configuration variable.
{{ environment.variables.retool_api_list_users_token }}

Instructor adds Resource to Permission Group
- Go to Settings > Groups
- Edit the
Student Permission Groupand add the newly created Resource withEdit access.

Create User Workflow
- Go to Workflows > Folder > Create.
- Name the workflow,
user-mgmt-workflow. - Delete the code block.
- Add a Resource Query block and specify the Resource created previously.
- Name the resource
listUsersand specify users.

- To get a specific user we create another block.
- Name the resource query block,
getUser. - Update the URI portion to identify the user id.
{{ listUsers.data.data[0].id}}

- To create a user, we create another block.
- Name the resource query block, createUser.
- Change the Method to POST
- Add users to the URL
- Specify Headers Content-type = application/json and Accept = application/json
- Specify RAW for the body and copy and paste the following:
{
"email": "<yourfirstname>@example.com",
"first_name": "<yourfirstname>",
"last_name": "Simple",
"active": true,
"metadata": {},
"user_type": "default"
}

Test User Workflow
- Select Run to execute the workflow.
- This will display the History panel and identify the tasks that completed.
- Select
listUsers,getUser, andcreateUserto view the output of each of these steps.
