How to create zoom meeting API with JWT token in nodeJS
Today i am going to share you how we can create zoom meeting with help of nodejs. In some meeting schedule projects we need to send meeting URL without password so members can join meeting with just a link. So lets start the code.
We need two node js libraries for zoom api.
- request-promise
- jsonwebtoken
For install these libraries just run these commands:
- npm i request-promise
- npm i jsonwebtoken
Now you need zoom app jwt API key and token. You can visit developer section in zoom website and create these app details. please follow these steps:
- Go to developer zoom account. https://developers.zoom.us/
- Now click on BUILD APP button there you need to create your zoom account and you can see this screen after login
- Choose JWT and click on create button.
- Now you need to add your app details and then you get API secret and token.
- And then create JWT token with help of jsonwebtoken and request-promise library
- Then pass into this code this is full code how we can create meeting join url with help of Zoom API and node js.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
const express = require('express'); const app = express(); const port = process.env.PORT || 3000; var http = require('http').Server(app); const path = require('path'); const fs = require('fs') const rp = require('request-promise'); const jwt = require('jsonwebtoken'); const payload = { iss: 'API_KEY', exp: ((new Date()).getTime() + 5000) }; const token = jwt.sign(payload, 'API_SECRET'); app.get("/newmeeting", (req, res) => { email = "youremail@gmail.com"; var options = { method: "POST", uri: "https://api.zoom.us/v2/users/" + email + "/meetings", body: { topic: "test meeting title", type: 1, settings: { host_video: "true", participant_video: "true" } }, auth: { bearer: token }, headers: { "User-Agent": "Zoom-api-Jwt-Request", "content-type": "application/json" }, json: true //Parse the JSON string in the response }; rp(options) .then(function(response) { console.log("response is: ", response); res.send("create meeting result: " + JSON.stringify(response)); }) .catch(function(err) { // API call failed... console.log("API call failed, reason ", err); }); }); http.listen(port, () => console.log(`Listening on port ${port}`)); |
OUTPUT
Thanks for reading, Happy learning.