Creating a meeting for other account

hi, I was planning to create some meetings from our website wherein the goal is to create multiple meetings for other accounts. my concept is when a site user gets invited in a meeting it will automatically creates a meeting for the 2 site users and start the meeting in zoom. I have tried using “schedule_for” but I get an error “You cannot schedule a meeting for test2@gmail.com” (SS: Monosnap)

Please help me. I am still using free account because I am not sure if a pro account or business account can solve this issue.

@glenn ,

schedule_for is used when a user has a personal assistance.

If you just wanted to create a meeting on test2@gmail.com’s account, just use Oauth or Server to Server Oauth, and call the create meeting api with the user’s ID.

hi @chunsiong.zoom, can I have a sample on which Sever to server Oauth scope should I select?

I was able to create a meeting for me but I wasn’t able to create a meeting for someone who is not under my account
here is my code

<?
function creatTok(){
    // Access the environment variables
$clientId  = '3XQrKFOTwKS0CEiKIk0XQ';
$clientSecret  = 'yVPjrU6q3EKit21varPFd7ijR19Zw7Fq';
$accountId= '9pvnj0wYSoqoD5cHQpAzsw';
$oauthUrl = 'https://zoom.us/oauth/token?grant_type=account_credentials&account_id=' . $accountId;  // Replace with your OAuth endpoint URL

    
    
        try {
            // Create the Basic Authentication header
            $authHeader = 'Basic ' . base64_encode($clientId . ':' . $clientSecret);
         
            // Initialize cURL session
            $ch = curl_init($oauthUrl);
    
            // Set cURL options
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: ' . $authHeader));
    
            // Execute cURL session and get the response
            $response = curl_exec($ch);
    
            // Check if the request was successful (status code 200)
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            if ($httpCode == 200) {
                // Parse the JSON response to get the access token
                $oauthResponse = json_decode($response, true);
                $accessToken = $oauthResponse['access_token'];
                //return $accessToken;
                http_response_code(200); // Replace 200 with your desired status code
                // Set the "Content-Type" header to "application/json"
                header('Content-Type: application/json');
                return $accessToken;
          
                
            } 
            else {
                echo 'OAuth Request Failed with Status Code: ' . $httpCode . PHP_EOL;
                echo $response . PHP_EOL;
                return null;
            }
    
            // Close cURL session
            curl_close($ch);
        } catch (Exception $e) {
            echo 'An error occurred: ' . $e->getMessage() . PHP_EOL;
            return null;
        }

}
$clientid = 'SrJlLtIzRs2ABmyKr7AwUw';
$clientSecret = 'K9RCEO9R7zQwMHWCLALFRtUJq9Quoawc';

$token = creatTok();

// API Endpoint for creating a meeting
$zoomEndpoint = 'https://api.zoom.us/v2/users/me/meetings';

// Meeting data
$meetingData = [
    'topic' => 'Test Meeting 6',
    'schedule_for' => 'test2@gmail.com',
    'type' => 2, // Scheduled meeting
    'start_time' => date('Y-m-d\TH:i:s', strtotime('+1 day')), // Start time (in UTC)
    'duration' => 60, // Duration in minutes
    'timezone' => 'UTC', // Timezone
    'settings' => [
        'approval_type' => 2,
        'join_before_host' => true,
        'jbh_time' => 0,
        'alternative_hosts' => 'glenramos0406@gmail.com',
    ]
];
// Prepare headers
$headers = [
    'Authorization: Bearer ' . $token,
    'Content-Type: application/json',
];

// Make POST request to create meeting
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $zoomEndpoint);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($meetingData));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
curl_close($ch);

// Decode JSON response
$responseData = json_decode($response, true);
print_r($responseData);

@glenn

I was able to create a meeting for me but I wasn’t able to create a meeting for someone who is not under my account

This is the correct design.

If you want to create a meeting for someone else’s account, you would need their explicit permission.

In this case, you would probably want to create an OAuth app, get the user to go thru the OAuth flow to give permission to your application to create meeting on behalf.

Sorry for the incorrect scenario that I mentioned earlier. What I was hoping for is for the site to create a meeting for non-Zoom logged-in users and to make it possible to start multiple meetings so that the owner of the API doesn’t need to enter the room to start them.

@glenn , rule of thumb is that 1 user can have 1 meeting at a single point in time. Even if the meeting is started by someone else (co-host), it still count towards this 1 user 1 meeting at single point in time.