How to add Zoom to your event meetings

How to add Zoom to your event meetings

5 min read

Being able to create meeting invites programmatically is great, but what if you want to include Zoom links in your invitation? To do this manually, you need to go into Zoom, create an meeting link, then go back to the meeting invite and add it. Wouldn’t it be great to make this happen automatically? Thankfully, it’s not that hard. Let’s use the Nylas Python SDK to make this happen.

Is your system ready?

If you already have the Nylas Python SDK installed and your Python environment configured, skip to the next section.

If not, read the post How to Send Emails with the Nylas Python SDK, where I cover the basic steps to set up your environment.

What are we going to talk about?

Creating a Zoom application

We’re going to build an application that will allow Nylas to be integrated with Zoom so that our event meetings can include Zoom invites.

First, we need to go to the Zoom Marketplace. Click the Develop dropdown menu and click Build App.

Build Zoom App

Next, find the OAuth tile and click Create.

Choose OAuth

Choose a name for your application and choose User-managed app. Since this is just for our own project, we don’t need to publish the application to the Zoom marketplace:

Creating the Zoom OAuth app

When you create your OAuth application, Zoom gives you both a Client ID and a Client Secret. Keep them safe because we’re going to need them in the following steps. You also need to provide a Redirect URL for OAuth (which doesn’t need to be a real working one).

Add Redirect URL for Oauth

Also, it’s important to add a callback in the Add Allow List field. Choose one depending on your location:

  • https://beta.us.nylas.com/connect/callback
  • https://beta.eu.nylas.com/connect/callback
Add Allow List

Now, we need to fill in some information about our application:

Basic app information for our Zoom application
Developer information

After this is all set up, we get to add features to our application:

Event subscription

We don’t need this for this application and using Event Subscriptions is optional, so let’s ignore it for now. Click Continue, because the next screen is important: Here is where we Add scopes:

Add scopes

Click Add Scopes. These scopes are what allow us to create Zoom meetings from our Zoom app. Select the following scopes:

  • In the Meeting section: select View and manage your meetings
  • In the User section: select View your user information
Add Meeting scopes
Add user scopes

When you click Done, Zoom adds the user scopes you selected to your app.

Scopes added and ready

When we’re done adding scopes, our OAuth application is ready. You don’t need to do anything else in Zoom at this point:

Zoom app is done

Creating a Zoom integration

We’re going to authenticate our request, and for that, we need to base64 encode our Nylas’ Client ID and Client Secret for basic authentication:

$ echo ‘<NYLAS_CLIENT_ID:CLIENT_SECRET>’ | base64
Encoding our Client ID and Client Secret

Store the result because we’re going to need it later. Next, we need to create an integration request:

$ curl --location --request POST 'https://beta.us.nylas.com/connect/integrations' \
--header 'Authorization: Basic <NYLAS_BASE64>' \
--header 'Content-Type: application/json' \
--data-raw '
{
  "name": "<YOUR_APP_NAME>",
  "provider": "zoom",
  "settings": {
    "client_id": "<ZOOM_CLIENT_ID>",
    "client_secret": "<ZOOM_CLIENT_SECRET>"
  },
  "redirect_uris": [
    "https://myapp.com/callback-handler"
  ],
  "expires_in": 1209600
}'

When you make this request Nylas sets up a Zoom integration for us. Next, we’ll need to grant account access to Zoom:

$ curl --location --request POST 'https://beta.us.nylas.com/connect/auth' \
--header 'Authorization: Basic <NYLAS_BASE64>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "provider": "zoom",
  "redirect_uri": "https://myapp.com/callback-handler",
  "expires_in": 43200,
  "account_id": "<NYLAS_ACCOUNT_ID>"
}' 

After we run this, your browser opens to a Zoom OAuth access request page:

Giving Zoom app permissions

We just need to click Allow and we’re good to go.

Coding our Meetings with a Zoom application

We’re now ready to create a meeting invite. Create a script called CreateEventZoom.py with the following code:

# Import packages
import os
import datetime
from datetime import date
from nylas import APIClient
from dotenv import load_dotenv

# Load your env variables
load_dotenv()

# Initialize an instance of the Nylas SDK using the client credentials
nylas = APIClient(
    os.environ.get("CLIENT_ID"),
    os.environ.get("CLIENT_SECRET"),
    os.environ.get("ACCESS_TOKEN"),
)

# Get today's date
today = date.today()
# Define start and end of the event
START_TIME = int(datetime.datetime(today.year, today.month, today.day, 19, 30, 0).strftime('%s'))
END_TIME = int(datetime.datetime(today.year, today.month, today.day, 20, 0, 0).strftime('%s'))

# Create the event
event = nylas.events.create()

# Pass the title, location, time, participants and from which calendar is coming from
# also, add Zoom autocreation capabilities
event.title = "Let's learn some Nylas Python API!"
event.location = "Blag's Den!"
event.when = {"start_time": START_TIME, "end_time": END_TIME}
event.participants = [{"name": "Blag", 'email': 'atejada@gmail.com'}]
event.calendar_id = os.environ.get("CALENDAR_ID")
event.conferencing = {
    "provider": "Zoom Meeting",
        "autocreate": {},
}
# Notify participants
event.save(notify_participants=True)

# If everything goes as planned
if event.id:
	print("Event created successfully")
	print(event)
# There was an error
else:
	print("There was an error creating the event")

Running our Meeting with Zoom application

We can run our application just by calling it from the terminal window:

$ python3 CreateEventZoom.py

If everything goes correctly, our application will generate our event meetings invite with a Zoom link attached:

Meeting event with Zoom link created

If you want to learn more about our Calendar APIs, see our documentation Calendar API Overview.

You can sign up for a Nylas for free and start building!

Related resources

How to create and read Google Webhooks using Ruby

Create and read your Google webhooks using Ruby and Sinatra, and publish them using Koyeb. Here’s the full guide.

Build mail merge and email templates using TinyMCE Rich Text Editor

Learn how to build Mail Merge and Email Template functionality in your email workflow using TinyMCE Rich Text Editor.

Send emails using TinyMCE Rich Text Editor

Learn how to improve your email workflow using TinyMCE Rich Text Editor.