Start Meeting as Host

A Zoom meeting is considered “started” when the host user enters the meeting. In the Web SDK, this is done by joining the user as role: 1, for host.

Zoom meetings are also considered “started” when at least two non-host participants join a meeting which has “Join before host” enabled in its settings.

Joining and starting a meeting as a host follows a similar process to joining a meeting as a participant; however, as a host the role will be 1.

To host a meeting through the Web SDK, the meeting ID will need to be on the same account as your API Key. In other words, your Web SDK app will be able to host meetings for users on your account. If your Web SDK app attempts to join a participant as host, but the user cannot be validated, they will join as a participant. If your meetings have “Join before host” disabled, users would enter the meeting’s Waiting Room until the host joins.

Creating a Meeting for the Host

To join and start a meeting in the Web SDK, you will need the meeting ID and passcode.

For testing, create a meeting in your Zoom client or at https://zoom.us/meeting/schedule to retrieve a Meeting ID and passcode. If you already have a meeting ID for the intended host to join, continue on.

The API Key and Secret used for your Web SDK app can also be used to authenticate the Zoom API. Following our guide to JWT Authorization, your web app can make requests to Create a Meeting or Get a Meeting. Pass the host user’s user ID or email in the path of these requests to create or read their meetings.

Note: your API Key and Secret will only have access to users on your account.

Create meetConfig object

To receive user input and meeting settings, create a client-side meetConfig object to pass data to a server-side generateSignature function and the meeting join methods.

In the same way as joining a meeting as a participant, create a meetConfig object to pass to a server-side generateSignature function. When starting a meeting as a host, join the user as role: 1:

Example meetConfig object:

const meetConfig = {
	apiKey: '3239845720934223459',
	meetingNumber: '123456789',
	leaveUrl: 'https://yoursite.com/meetingEnd',
	userName: 'Firstname Lastname',
	passWord: 'password',
	role: 1 // 1 for host
};

Launch & Join Meeting as Host

Pass your meetConfig object to a getSignature function. Make a request to your signature endpoint, then pass that response to call the init method.

In the ZoomMtg.init() method, set any meeting settings (ex: leaveUrl, isSupportAV).

Call the ZoomMtg.join() method as a success param of ZoomMtg.init(). The join() method will handle your signature (as a text string).

index.js
import { ZoomMtg } from '@zoomus/websdk'

// prepare required files
ZoomMtg.preLoadWasm();
ZoomMtg.prepareJssdk();

getSignature(meetConfig) {
    // make a request for a signature
    fetch(`${YOUR_SIGNATURE_ENDPOINT}`, {
        method: 'POST',
        body: JSON.stringify({
          meetingData: meetConfig
        })
      })
      .then(result => result.text())
      .then(response => {
          // call the init method with meeting settings
          ZoomMtg.init({
            leaveUrl: meetConfig.leaveUrl,
            isSupportAV: true,
            // on success, call the join method
            success: function () {
              ZoomMtg.join({
                // pass your signature response in the join method
                signature: response,
                apiKey: meetConfig.apiKey,
                meetingNumber: meetConfig.meetingNumber,
                userName: meetConfig.userName,
                passWord: meetConfig.passWord
                error(res) {
                  console.log(res)
                }
              })
            }
          })
        })
      }

Set this function to launch within your application, for example, on a “Start Meeting” button.