Help understanding how to create meeting using backend

Hi All
I am using zoom to create meetings on the backend and join meetings on the frontend.
The frontend sample worked great to join a meeting I created using the zoom dashboard, now I need to create a meeting using nodejs backend.

I am using this project on github ( https://github.com/zoom/sample-app-node ), which btw seems very outdated since it mentions v1 api, but since I could not find a sample that guides me better than that one, that’s what I choose so far, please let me know if there is a more up to date.

My problem is that I am trying to make that nodejs sample work, and when I read the docs it mentions a complete different way to make calls to the zoom api.

So finally to my first question, today, to create a meeting using the api rest calls, do I really need to either have a jwt token to be used in every request, or use oauth?
I am very new to nodejs and backend in general, so I do not understand how all this is supposed to come together so the api calls can be made.
Question 1.a, if the answer above is true, can the jwt/oauth be handled in the same nodejs server as the one that is going to make the api call to create the meeting? Since all the samples are very specific to only one task, it gives me the impression that I would need a server that only gets the JWT or makes the oauth and another one that does in fact the create meeting api call…

Second question
I there a sample somewhere that shows how a nodejs server would use either jwt or oauth and make a create meeting call using the latest API (v2) ?

Ok so I’ll keep answering my own questions, to whomever is interested in this: How to create a meeting using nodejs

Download the jwt sample from https://github.com/zoom/zoom-api-jwt and follow the steps presented there to install

Create a new request handler just before the lines:

//use userinfo from the form and make a post request to /userinfo
app.post("/userinfo", (req, res) => {

and add the follwing sample code:

app.post("/newmeeting", (req, res) => {
  email = "your maketplace developer email";
  var options = {
    method: "POST",
    uri: "https://api.zoom.us/v2/users/" + email + "/meetings",
    body: {
      topic: "test create meeting",
      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);
    });
});

And make your postman/frontend call to that newmeeting endpoint like localhost:3000/newmeeting …

1 Like

Hey @gabriel.rf0,

That is exactly how to do it! :slight_smile:

Let me know if you have additional questions!

Thanks,
Tommy

Thank you @gabriel.rf0, you helped me a lot with this answer, doc’s sample with OAuth, confused me!

1 Like

Happy to hear you got the help you needed! :slight_smile:

-Tommy

hey bro
can you help me in create meeting bro i’m confused that i have run a zoom-api-jwt-master sample app and i got this


Now what next i should do now i can’t understand please help me.

Hi @junaidali9559 , basically you need to copy and paste the example code from @gabriel.rf0 in the index.js file and replace the line
email = "your maketplace developer email"; with your email.
then change
<form action="/userinfo" method="post">
to
<form action="/newmeeting" method="post">
in the public/index.html file
Then go to localhost:3000/newmeeting and you will get the JSON response with the created meeting information printed.

1 Like

Hi @le.oviedo, after doing all this i get this error now image
after adding @gabriel.rf0 code snippet my index.js file code is this

//include required modules
const jwt = require(‘jsonwebtoken’);

const config = require(’./config’);
const rp = require(‘request-promise’);

const express = require(‘express’);
const app = express();

app.use(express.urlencoded({ extended: true }));
app.use(express.static(‘public’));
var email, userid, resp;
const port = 3000;

//Use the ApiKey and APISecret from config.js
const payload = {
iss: config.APIKey,
exp: ((new Date()).getTime() + 5000)
};
const token = jwt.sign(payload, config.APISecret);

//get the form
app.get(’/’, (req,res) => res.send(req.body));
app.post("/newmeeting", (req, res) => {
email = “junaidali9559@gmail.com”;
var options = {
method: “POST”,
uri: “https://api.zoom.us/v2/users/” + email + “/meetings”,
body: {
topic: “test create meeting”,
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);
});
});

//use userinfo from the form and make a post request to /userinfo
app.post(’/userinfo’, (req, res) => {
//store the email address of the user in the email variable
email = req.body.email;
//check if the email was stored in the console
console.log(email);
//Store the options for Zoom API which will be used to make an API call later.
var options = {
//You can use a different uri if you’re making an API call to a different Zoom endpoint.
uri: “https://api.zoom.us/v2/users/”+email,
qs: {
status: ‘active’
},
auth: {
‘bearer’: token
},
headers: {
‘User-Agent’: ‘Zoom-api-Jwt-Request’,
‘content-type’: ‘application/json’
},
json: true //Parse the JSON string in the response
};

//Use request-promise module’s .then() method to make request calls.
rp(options)
.then(function (response) {
//printing the response on the console
console.log(‘User has’, response);
//console.log(typeof response);
resp = response
//Adding html to the page
var title1 ='

Your token:


var result1 = title1 + ‘
’ + token + ‘
’;
var title =‘

User’s information:


//Prettify the JSON format using pre tag and JSON.stringify
var result = title + ‘
’+JSON.stringify(resp, null, 2)+ ‘

res.send(result1 + ‘
’ + result);
})
.catch(function (err) {
    // API call failed...
    console.log('API call failed, reason ', err);
});

});

app.listen(port, () => console.log(Example app listening on port ${port}!));

What should i do now please help me.
Thanks

Hi @junaidali9559, open public/index.html
then change
<form action="/userinfo" method="post">
to
<form action="/newmeeting" method="post">
and it should work

1 Like

hi @le.oviedo yes its working now thank you!
But what should i do next now i want this to run with web sdk on my company website. What should i do please help me!

1 Like

Hey @junaidali9559,

Happy to hear you got it working! @le.oviedo thanks for your help! :slight_smile:

@junaidali9559, you can take the code from our sample app and put it on your website, or follow the guide here: https://www.npmjs.com/package/@zoomus/websdk

Thanks,
Tommy