How to Create Zoom Meeting URLs on Your Website

Written by kanchansonwani | Published 2023/10/04
Tech Story Tags: web-development | zoom | api-integration | curl | php | zoom-meetings | zoom-meeting-urls | meeting-urls-on-website

TLDRI recently came across a project where I needed to develop a platform where users can take live sessions via Zoom Meetings. These are the steps you can follow to create a Zoom Meeting URL and join a meeting from your website. via the TL;DR App

I recently came across a project where I needed to develop a platform where users can purchase and take live sessions via the Zoom App.

So I went through Zoom’s official documents and found a lot of APIs provided by the Zoom App.

I took a few steps from there and I searched a few steps on the internet. These are the steps you can follow to create a Zoom Meeting URL and join a meeting from your website browser.

  1. Create an App from the Zoom marketplace:

    1. First, you need to create a Zoom profile from https://zoom.us/. Once you finish that, you need to build an app from this URL https://marketplace.zoom.us/. Go to that URL, see the “Develop” Menu on top and then click on “Build” from the dropdown.

    2. Next, you need to choose “Server-to-Server OAuth“ and then click the Create button.

    3. Once done, follow the steps one by one. In that step, you must also choose Scope, Which is very important. To be able to create a Zoom Meeting URL, you must choose a few scopes that are required to use Meeting API.

      1. these are the scopes you need to choose:

        1. “View and manage account info”
        2. “View and manage sub account's user meetings”
        3. “View and manage all user meetings”
    4. once you complete all the steps to build “server to server OAuth”. you need to get an access token.

  2. Access Token

    1. you need to have an access token which will be used later in Creating the meeting URL.

    2. so you will need the account ID, client ID, and client secret and use them to get an access token.

      1. you need to call this Zoom API https://zoom.us/oauth/token?grant_type=account_credentials&account_id=<your_account_id>

        1. you will get <account_id> from the “server-to-server-oauth” app you built in previous step. go to <https://marketplace.zoom.us/ > and find the “manage” menu on top and once you click it, you’ll get all the apps you have created. so find your created app there and once you go inside that, you can see the app credential option there. under that, you will get the necessary keys. remember this because we will use the client ID and client secret to get the access token.
        2. OK now you have the account id, I am using Postman to create an access token, You need to call this API using any programming language. you need to create this token every time you make a Meeting URL. Because it gets expired. so in the Postman App, call that API with the POST method and choose Basic Authorization, where you need to use the client ID as the user ID and the client secret as the password in Postman.
        3. that is it. once you hit the API, you will get an access token in response.
  3. so now you have built the app and got an access token for it. Now we will use this to create a meeting URL.

  4. https://api.zoom.us/v2/users/<your_zoom_profile_username>/meetings

  5. that API URL, we need to access the token and use the POST method along with the required data (you can find them in Zoom doc). See the example below. I have used PHP and curl

    1. $data = array();
      $data['topic'] 		= 'Example Test Meeting';
      $data['start_date'] = date("Y-m-d h:i:s", strtotime('tomorrow'));
      $data['duration'] 	= 30;
      $data['type'] 		= 2;
      $data['password'] 	= "12345";
      
      

      $access_token = "<Your_generated_access_token>";
      $request_url = "https://api.zoom.us/v2/users/[email protected]/meetings";
      		
      		$headers = array(
      			"authorization: Bearer ".$access_token,
      			"content-type: application/json",
      			"Accept: application/json",
      		);
      		
      		$postFields = json_encode($data);
      		
              	$ch = curl_init();
              	curl_setopt_array($ch, array(
                  	CURLOPT_URL => $request_url,
      	    	CURLOPT_RETURNTRANSFER => true,
      	    	CURLOPT_ENCODING => "",
      	    	CURLOPT_MAXREDIRS => 10,
      	    	CURLOPT_TIMEOUT => 30,
      	    	CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      	    	CURLOPT_CUSTOMREQUEST => "POST",
      	    	CURLOPT_POSTFIELDS => $postFields,
      	    	CURLOPT_HTTPHEADER => $headers,
              	));
      
              	$response = curl_exec($ch);
              	$err = curl_error($ch);
              	curl_close($ch);$request_url = "https://api.zoom.us/v2/users/[email protected]/meetings";
      		
      		$headers = array(
      			"authorization: Bearer ".$this->access_token,
      			"content-type: application/json",
      			"Accept: application/json",
      		);
      		
      		$postFields = json_encode($data);
      		
              	$ch = curl_init();
              	curl_setopt_array($ch, array(
                  	CURLOPT_URL => $request_url,
      	    	CURLOPT_RETURNTRANSFER => true,
      	    	CURLOPT_ENCODING => "",
      	    	CURLOPT_MAXREDIRS => 10,
      	    	CURLOPT_TIMEOUT => 30,
      	    	CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      	    	CURLOPT_CUSTOMREQUEST => "POST",
      	    	CURLOPT_POSTFIELDS => $postFields,
      	    	CURLOPT_HTTPHEADER => $headers,
              	));
      
              	$response = curl_exec($ch);
              	$err = curl_error($ch);
              	curl_close($ch);
      
      echo json_decode($response);
      
      
        
      

That’s it. Have a great time coding.


Written by kanchansonwani | Freelancer | Tech Blogger
Published by HackerNoon on 2023/10/04