Integrating Zoom's API allows you to automate meeting scheduling and management. With this integration, you can schedule and manage meetings without needing a paid Zoom plan. Hereβs a step-by-step guide to get you started with Zoom API integration using Node.js and Express.
Prerequisites
Basic knowledge of Node.js and Express.
A Zoom account.
Node.js and npm installed on your machine.
Step-by-Step Instructions
1. Create a Zoom App
- Create a Zoom Account: If you don't have one, sign up at Zoom Marketplace.
Develop an App: Go to the Zoom Marketplace and click on the "Develop" icon.
Build App: Click on "Build App" and select "Server to Server OAuth" app type.
Store Credentials: After creating the app, store the following details securely:
ZOOM_CLIENT_ID
ZOOM_CLIENT_SECRET
ZOOM_ACCOUNT_ID
2. Set Up Your Project
- Create a Project Folder: Create a new folder for your project and initialize it with npm.
mkdir zoom-meeting-integration
cd zoom-meeting-integration
npm init -y
- Install Dependencies: Install the required libraries using npm.
npm install axios body-parser dotenv express
- Create Environment Variables: Create a .env file in the root directory of your project and add your Zoom credentials:
ZOOM_CLIENT_ID=YOUR_ZOOM_CLIENT_ID
ZOOM_CLIENT_SECRET=YOUR_ZOOM_CLIENT_SECRET
ZOOM_ACCOUNT_ID=YOUR_ZOOM_ACCOUNT_ID
3. Implement API Integration
- Create an Index File: Create a file named index.js and set up your basic Express server:
const express = require('express');
const bodyParser = require('body-parser');
const axios = require('axios');
require('dotenv').config();
const app = express();
app.use(bodyParser.json());
// Your code will go here
app.listen(3000, () => {
console.log('Server is running on port 3000');
});
- Get an Access Token: Create a function to get an OAuth token from Zoom. Add the following code to index.js:
async function getAccessToken() {
const response = await axios.post('https://zoom.us/oauth/token', null, {
params: {
grant_type: 'account_credentials',
},
auth: {
username: process.env.ZOOM_CLIENT_ID,
password: process.env.ZOOM_CLIENT_SECRET,
},
});
return response.data.access_token;
}
- API Payload
{
"topic": "Sample Meeting",
"type": 1,
"duration": 30,
"start_time": "2024-09-01T10:00:00Z",
"agenda": "Discuss project updates"
}
- Schedule a Meeting: Create an endpoint to schedule a meeting using the Zoom API:
app.post('/schedule-meeting', async (req, res) => {
try {
const token = await getAccessToken();
const meetingData = {
topic: 'Sample Meeting',
type: 1,
duration: 30,
start_time: '2024-09-01T10:00:00Z',
agenda: 'Discuss project updates',
};
const response = await axios.post('https://api.zoom.us/v2/users/me/meetings', meetingData, {
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
},
});
res.json(response.data);
} catch (error) {
res.status(error.response ? error.response.status : 500).send(error.message);
}
});
- Retrieve Meeting Link: Once you have the meeting ID, you can use it to get the meeting link:
app.get('/meeting-link/:meetingId', async (req, res) => {
try {
const token = await getAccessToken();
const meetingId = req.params.meetingId;
const response = await axios.get(`https://api.zoom.us/v2/meetings/${meetingId}`, {
headers: {
Authorization: `Bearer ${token}`,
},
});
res.json({ join_url: response.data.join_url });
} catch (error) {
res.status(error.response ? error.response.status : 500).send(error.message);
}
});
- Sending Meeting Links Send Emails: After retrieving the meeting link, you can use any mail service (e.g., Nodemailer) to send the meeting link to participants.
- Additional Information
- Meeting Features: Note that the API for adding participants may require a paid Zoom plan. For free plans, you can only schedule meetings and share the links manually.
- Refer to GitHub: For a complete implementation, check out the GitHub repository Zoom Meeting Scheduler.
By following these steps, you can successfully integrate Zoom API into your application for scheduling and managing meetings.
Top comments (0)