Integrate zoom with laravel

Integrate zoom with laravel

 

https://marketplace.zoom.us/

Goto right corner develop dropdown and enter mouse it and click on create build app link

client_id = GBtAuW3fQuyz0MgyIWM_mA
client_secret = 4caJamU31pXeCm27pXiaMv79UYkr2Hwe
composer require macsidigital/laravel-zoom
right cmd: composer require jubaer/zoom-laravel
php artisan vendor:publish --provider="MacsiDigital\Zoom\ZoomServiceProvider"
right cmd: php artisan vendor:publish --provider="Jubaer\Zoom\ZoomServiceProvider"
This creates a config/zoom.php file. 

return [
'client_id' => env('ZOOM_CLIENT_KEY'),
'client_secret' => env('ZOOM_CLIENT_SECRET'),
'account_id' => env('ZOOM_ACCOUNT_ID'),
'base_url' => 'https://api.zoom.us/v2/',
];


.env

ZOOM_CLIENT_KEY=__ORBcglSiSRh4mwJEs3Q
ZOOM_CLIENT_SECRET=iU11zy8OObyUpa998wq3yQjUiqOZW6WY
ZOOM_REDIRECT_URI=https://yourdomain.com/zoom/callback
ZOOM_ACCOUNT_ID=vJO6lv6QS1SFe9lLUlYhYg
ZOOM_BASE_URL=https://api.zoom.us/v2/

config/app.php

'providers' => [
    // ...
    Jubaer\Zoom\ZoomServiceProvider::class,
];

'aliases' => [
// ...
'Zoom' => Jubaer\Zoom\Facades\Zoom::class,
];


For a user specific user zoom configuration add User model:

public static function clientID()
{
return 'zoom_client_of_user';
}

public static function clientSecret()
{
return 'zoom_client_secret_of_user';
}

public static function accountID()
{
return 'zoom_account_id_of_user';
}

Create a meeting

$meetings = Zoom::createMeeting([
"agenda" => 'your agenda',
"topic" => 'your topic',
"type" => 2, // 1 => instant, 2 => scheduled, 3 => recurring with no fixed time, 8 => recurring with fixed time
"duration" => 60, // in minutes
"timezone" => 'Asia/Dhaka', // set your timezone
"password" => 'set your password',
"start_time" => 'set your start time', // set your start time
"template_id" => 'set your template id', // set your template id Ex: "Dv4YdINdTk+Z5RToadh5ug==" from https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingtemplates
"pre_schedule" => false, // set true if you want to create a pre-scheduled meeting
"schedule_for" => 'set your schedule for profile email ', // set your schedule for
"settings" => [
'join_before_host' => false, // if you want to join before host set true otherwise set false
'host_video' => false, // if you want to start video when host join set true otherwise set false
'participant_video' => false, // if you want to start video when participants join set true otherwise set false
'mute_upon_entry' => false, // if you want to mute participants when they join the meeting set true otherwise set false
'waiting_room' => false, // if you want to use waiting room for participants set true otherwise set false
'audio' => 'both', // values are 'both', 'telephony', 'voip'. default is both.
'auto_recording' => 'none', // values are 'none', 'local', 'cloud'. default is none.
'approval_type' => 0, // 0 => Automatically Approve, 1 => Manually Approve, 2 => No Registration Required
],

]);


Get a meeting 
$meeting = Zoom::getMeeting($meetingId);

Update a meeting

$meeting = Zoom::updateMeeting($meetingId, [
"agenda" => 'your agenda',
"topic" => 'your topic',
"type" => 2, // 1 => instant, 2 => scheduled, 3 => recurring with no fixed time, 8 => recurring with fixed time
"duration" => 60, // in minutes
"timezone" => 'Asia/Dhaka', // set your timezone
"password" => 'set your password',
"start_time" => 'set your start time', // set your start time
"template_id" => 'set your template id', // set your template id Ex: "Dv4YdINdTk+Z5RToadh5ug==" from https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingtemplates
"pre_schedule" => false, // set true if you want to create a pre-scheduled meeting
"schedule_for" => 'set your schedule for profile email ', // set your schedule for
"settings" => [
'join_before_host' => false, // if you want to join before host set true otherwise set false
'host_video' => false, // if you want to start video when host join set true otherwise set false
'participant_video' => false, // if you want to start video when participants join set true otherwise set false
'mute_upon_entry' => false, // if you want to mute participants when they join the meeting set true otherwise set false
'waiting_room' => false, // if you want to use waiting room for participants set true otherwise set false
'audio' => 'both', // values are 'both', 'telephony', 'voip'. default is both.
'auto_recording' => 'none', // values are 'none', 'local', 'cloud'. default is none.
'approval_type' => 0, // 0 => Automatically Approve, 1 => Manually Approve, 2 => No Registration Required
],

]);

Delete a meeting

 $meeting = Zoom::deleteMeeting($meetingId);

Get all meetings

 $meetings = Zoom::getAllMeeting();

Get a meeting

 $meeting = Zoom::getMeeting($meetingId);

Get all upcoming meetings

 

 $meetings = Zoom::getUpcomingMeeting();

Get all past meetings

 $meetings = Zoom::getPreviousMeetings();

reschedule meeting

$meetings = Zoom::rescheduleMeeting($meetingId, [
"agenda" => 'your agenda',
"topic" => 'your topic',
"type" => 2, // 1 => instant, 2 => scheduled, 3 => recurring with no fixed time, 8 => recurring with fixed time
"duration" => 60, // in minutes
"timezone" => 'Asia/Dhaka', // set your timezone
"password" => 'set your password',
"start_time" => 'set your start time', // set your start time
"template_id" => 'set your template id', // set your template id Ex: "Dv4YdINdTk+Z5RToadh5ug==" from https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingtemplates
"pre_schedule" => false, // set true if you want to create a pre-scheduled meeting
"schedule_for" => 'set your schedule for profile email ', // set your schedule for
"settings" => [
'join_before_host' => false, // if you want to join before host set true otherwise set false
'host_video' => false, // if you want to start video when host join set true otherwise set false
'participant_video' => false, // if you want to start video when participants join set true otherwise set false
'mute_upon_entry' => false, // if you want to mute participants when they join the meeting set true otherwise set false
'waiting_room' => false, // if you want to use waiting room for participants set true otherwise set false
'audio' => 'both', // values are 'both', 'telephony', 'voip'. default is both.
'auto_recording' => 'none', // values are 'none', 'local', 'cloud'. default is none.
'approval_type' => 0, // 0 => Automatically Approve, 1 => Manually Approve, 2 => No Registration Required
],

]);

end meeting

 $meetings = Zoom::endMeeting($meetingId);

delete meeting

 $meetings = Zoom::deleteMeeting($meetingId);

recover meeting

 $meetings = Zoom::recoverMeeting($meetingId);

Get all users

 $users = Zoom::getUsers(['status' => 'active']);

 // values are 'active', 'inactive', 'pending'. default is active. and you can pass 
page_size and page_number as well

 

Modify config/zoom.php to use environment variables: return [ 'api_key' => env('ZOOM_API_KEY'), 'api_secret' => env('ZOOM_API_SECRET'), ];
use MacsiDigital\Zoom\Facades\Zoom;

public function createZoomMeeting()
{
$user = Zoom::user()->first();

$meeting = Zoom::meeting()->make([
'topic' => 'Laravel Zoom Integration',
'type' => 2, // Scheduled meeting
'start_time' => now()->addMinutes(10), 
'duration' => 30, // 30 minutes
'timezone' => 'UTC',
'password' => '123456',
]);

$meeting->settings()->make([
'join_before_host' => true,
'host_video' => true,
'participant_video' => true,
'mute_upon_entry' => true,
'waiting_room' => false,
]);

$user->meetings()->save($meeting);

return response()->json([
'meeting_id' => $meeting->id,
'start_url' => $meeting->start_url,
'join_url' => $meeting->join_url,
]);
}
use App\Http\Controllers\ZoomController;

Route::get('/create-zoom-meeting', [ZoomController::class, 'createZoomMeeting']);
List All Meetings

$meetings = Zoom::user()->find('me')->meetings;
Get Meeting Details

$meeting = Zoom::meeting()->find($meetingId);
Delete a Meeting

$meeting = Zoom::meeting()->find($meetingId);
$meeting->delete();
Get Zoom Meeting Link

use MacsiDigital\Zoom\Facades\Zoom;

public function createZoomMeeting()
{
$user = Zoom::user()->first();

$meeting = Zoom::meeting()->make([
'topic' => 'Laravel Zoom Integration',
'type' => 2, // Scheduled meeting
'start_time' => now()->addMinutes(10), 
'duration' => 30, 
'timezone' => 'UTC',
'password' => '123456',
]);

$meeting->settings()->make([
'join_before_host' => true,
'host_video' => true,
'participant_video' => true,
'mute_upon_entry' => true,
'waiting_room' => false,
]);

$user->meetings()->save($meeting);

// Get the meeting link
$meetingLink = $meeting->join_url;

// Call the function to send an email
$this->sendZoomLinkEmail("recipient@example.com", $meetingLink);

return response()->json([
'meeting_id' => $meeting->id,
'start_url' => $meeting->start_url,
'join_url' => $meeting->join_url,
]);
}
Share meeting link in whatsapp

$meetingLink = "https://us02web.zoom.us/j/1234567890";
$whatsappMessage = "Join our Zoom meeting: " . urlencode($meetingLink);
$whatsappLink = "https://api.whatsapp.com/send?text=$whatsappMessage";

return redirect($whatsappLink);

 

 

 

Leave a Reply