- Products
- Solutions Use casesBy industry
- Developers
- Resources Connect
- Pricing
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.
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.
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.
Next, find the OAuth tile and click Create.
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:
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).
Also, it’s important to add a callback in the Add Allow List field. Choose one depending on your location:
Now, we need to fill in some information about our application:
After this is all set up, we get to add features to our application:
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:
Click Add Scopes. These scopes are what allow us to create Zoom meetings from our Zoom app. Select the following scopes:
When you click Done, Zoom adds the user scopes you selected to your app.
When we’re done adding scopes, our OAuth application is ready. You don’t need to do anything else in Zoom at this point:
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
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:
We just need to click Allow and we’re good to go.
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")
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:
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!
Blag aka Alvaro Tejada Galindo is a Senior Developer Advocate at Nylas. He loves learning about programming and sharing knowledge with the community. When he’s not coding, he’s spending time with his wife, daughter and son. He loves Punk Music and reading all sorts of books.