Skip to content

Automatically migrate Zoom recordings

Why migrate

We primarily use Zoom for meetings which records and stores it for 120 days. But the recordings can be required to be stored for much longer period, for example, in case of Business development meetings with new leads. These leads take much longer than 120 days to mature into sales.

Solution

A simple solution is to store these recordings in cloud, i.e. Google drive in our case. To automate the process of downloading and uploading to drive, we have implemented a python script.

The solution goes through a list of zoom accounts set up in configuration, downloads and then uploads all videos (based on filters provided) to google drive in the designated folder. It also sends email notification with details about migrated videos.

This script can be run locally as well as on Gitlab via schedules feature.

Running via Gitlab

Currently, the script is executed once every week.

Following environment variables are required to be configured before execution. Ideally, we just need to configure the below variables once in Gitlab CI/CD varibles settings.

  • GOOGLE_API_CREDENTIALS: Obtain service account credentials from google by following this document. Extract private_key, client_email and token_uri from the downloaded json file and set it in json format as given below.

    1
    2
    3
    4
    5
    {
        "private_key": "-----BEGIN PRIVATE KEY-----\nxxx...-----END PRIVATE KEY-----\n",
        "client_email": "xxxx@xxxxxxxx-xxx-xxxxxx.xxx.xxxxxxxxxxxxxxx.com",
        "token_uri": "https://oauth2.googleapis.com/token"
    }
    
  • ZOOM_ACCOUNTS: Create a variable with list of zoom accounts in below format. You can optionally set start, end date and pattern to filter recordings. Credentials (api_key and api_secret) can be generated by creating a JWT app in Zoom marketplace. The steps can be found here.

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    [
        # zoom account 1
        {
            "api_key": "xxxxxxxxxxxxxxxxxxxxxx",
            "api_secret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
            "user_id": "me", # optional: zoom user id
            # recipients will recieve a notification email about successful and failed videos
            "recipients": ["xxxxx@xxxxxxxxx.xxx"],
            "drive_folder_name": "xxxxxxxxxxxxxx",
            "start": "2022-07-01 00:00:00", # optional
            "end": "2022-07-08 00:00:00", # optional
            "pattern": "^.* - sprint retrospective$" # optional
        },
        # zoom account 2
        {
            "api_key": "xxxxxxxxxxxxxxxxxxxx-x",
            "api_secret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
            "recipients": ["xxxxx@xxxxxxxxx.com"],
            "drive_folder_name": "xxxxxxxxxxxxxx"
        }
    ]
    

  • DRIVE_BASE_DIR_ID: ID of the folder in drive to be used as base directory. All folders will be created inside this directory. Please share this directory with the service account.

  • EMAIL_SETTINGS: Configuration for sending emails.
    1
    2
    3
    4
    5
    6
    7
    8
    {
        "use_tls": true,
        "port": 1025,
        "host": "xxxxxxxxx",
        "host_user": "xxx",
        "host_password": "xxx",
        "from_email": "xxxxxxxx@xxxxxxx.xxx"
    }
    
  • DEBUG: [Optional] Setting this to true would allow you to download and upload videos without deleting them from zoom

Setup a schedule in gitlab. You can also trigger the schedule manually as described here.

Running locally

You can also run the script locally by setting up the same environment variables as mentioned above.

  • Install pre-requisites
1
make install_prereqs
  • Execute the script by running below command.
1
make migrate_zoom_meetings

Last update: 2022-07-08