This repository contains scripts to bulk update the classification label for "unclassified" boards in JavaScript (Node.js).
- NodeJS 16.x or higher installed
- You must be a Company Admin in your Miro account, or at least the user generating the token must be a Company Admin in your Miro account (see steps 3 to 5)
- You must have the role Content Admin assigned, or at least the user generating the token must have the role Content Admin assigned (see step 4 below)
Note: If the person running the script is not a Company Admin with the Content Admin role in your organization's Miro account, please have a Company Admin with the Content Admin role in your Miro account follow the steps 3 to 5. Once the token has been created, the Miro Company Admin with the Content Admin role can provide the token to the user who will run the scripts to execute the changes.
1.1. If you already have Node.js installed in your local machine, you may skip this step.
1.2. If you do not have Node.js installed, proceed to download it here and proceed to install Node with the downloaded file. (Feel free to use the command line to download and install Node if preferred).
2.1. In your local machine create a folder in the desired location where you will store the files within this repository.
2.2. Download this repository as .zip and extract the files within into the directory created, or clone this repository into the desired location in your local machine.
3.1. If you already have a Miro Developer Team, you may skip this step.
3.2. If you do not have yet a Miro Developer Team, please visit this Miro Help page and follow the instructions within the article to create an Enterprise Developer Team for your Miro Enterprise Account.
4.1. To be able to check all Boards within your Miro Enterprise Account (including Boards you have not been invited to) you need to have the role "Content Admin" assigned. To check this, proceed as explained in this Miro Help article.
4.2. If you do not appear within the users assigned to the "Content Admin" role, proceed to add yourself to the "Content Admin" users as explained in the Help article mentioned in step 4.1.
5.1. To create a new application on your Miro Enterprise account using the Enterprise Developer team, navigate to Profile settings > Your apps, agree to the terms and conditions, and click on + Create new app.
5.2. Insert the desired app name (e.g. Board Classification Script), select your Developer team for the application and click on Create app.
5.3. On the app page, scroll down and select the following scopes of access to grant to your REST API token:
boards:read
boards:write
organizations:read
organizations:teams:read
5.4. Click on Install app and get OAuth token
5.5. Select any team within your Enteprise account, the token will apply for the entire account based on the scopes set on step 5.3. and click on Add
5.6. You will see the REST API token. Copy this token and store it in a secure place. You will need it when running the scripts.
5.7. Find your Miro Organization ID as you will need it when running the scripts. You will find your Miro Organization ID in the URL of the page where you received the REST API token
6.1. In your command line interface navigate to the directory where you have placed the script files (see step 2.2)
6.2. In your command line interface run node get_labels.js
.
This script will show you the existing classification labels in your Miro account. It will also create a CSV file called classification_labels.csv
within the folder board_classification_labels
in the directory where the script files lives in your local machine.
6.3. Enter the information asked by the script when prompted:
Enter your Miro Organization ID
: enter your Miro Organization ID (see step 5.7) and hit "Enter"Enter your Miro REST API Token
: enter your Miro REST API Token (see step 5.6) and hit "Enter"
6.4. After the script get_classification.js
has run, review the classification labels from the list shown in the command line or open the classification_labels.csv
file within the folder board_classification_labels
.
6.5. Identify the label you want to use to classify the unclassified boards (you will be asked for the ID of the desired label on the next steps)
7.1. Run node classification.js
. The classification.js
script allows you to run the script in TEST MODE so you can test it without applying any changes. To run the script in TEST MODE simply respond to this particular question when prompted by the script
7.2. Enter the information asked by the script when prompted:
-
Is this a TEST Run? (y/n)
: Respondy
if you want to run the script in TEST MODE and hit "Enter". If you are ready to apply changes, entern
and the script will proceed to update the classification label for unclassified boards only. Already classified boards will not be updated. -
Enter the ID of the "Classification Label" to be used to classify the unclassified Boards
: enter the ID of the desired classification label that should be applied to classify the unclassified boards (see step 6.4) and hit "Enter" -
Enter your Miro Organization ID
: enter your Miro Organization ID (see step 5.7) and hit "Enter" -
Enter your Miro REST API Token
: Enter your Miro REST API Token (see step 5.6) and hit "Enter" -
Should this script create a full report of existing boards? (y = slower / n = faster)
: choose whether you want to have detailed reports of existing boards and their current classification labels before applying changes or not and hit "Enter"
7.3. After the script classification.js
has run, review the summary presented in the command line and review the reports created within the folder classification_output_files
in the directory where the script files live.
7.4. To confirm all unclassified Boards have been successfully classified, please go to https://miro.com/app/settings/company/{YOUR_MIRO_ORG_ID}/data-classification/
(replace {YOUR_MIRO_ORG_ID} in the URL with your Miro Organization ID from step 5.7) to confirm that there are no Boards left to classify (fastest option) or re-run this script with TEST MODE turned ON (slower option)
The steps in this section are optional but recommended.
After you have confirmed all unclassified boards have been successfully classified, you may want to revoke the REST API token if you don't plan to use these functionalities in the future.
8.1. To revoke the REST API token, go to Profile settings > Your apps (in your Miro account)
8.2. Locate the app created on step 5.2 and click on it
8.3. Scroll to the bottom of the page and click on the button outlined in red that reads Delete app
If you have any questions or need assistance setting up this application, please reach out to your Miro Customer Success Manager, Onboarding Consultant, Technical Architect or dedicated Miro Solutions Engineer.