Last active
January 8, 2024 16:04
-
-
Save adeel-raza/176446a358c8d3bf8ab8cf8b8ca204ad to your computer and use it in GitHub Desktop.
Dynamically Create a Meeting in your code with Zoom WordPress Plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function create_meeting_with_zoom_wordpress() { | |
// Place your Zoom user Host ID. Check it from Zoom Meetings -> Zoom Users -> Host ID | |
$zoom_host_id = 'x3VbIu8mT-m8-gWQNL05pQ'; | |
// Your Meeting Settings | |
$create_meeting_arr = array( | |
'userId' => $zoom_host_id, | |
'meetingTopic' => 'Your_Meeting_Topic', | |
'start_date' => '2024-01-09 05:00:00', // Set it to a Future date/time for a scheduled meeting | |
'timezone' => 'America/New_York', | |
'password' => 'test', | |
'join_before_host' => true, | |
); | |
$meeting_created = json_decode( zoom_conference()->createAMeeting( $create_meeting_arr ) ); | |
if ( ! empty( $meeting_created->code ) ) { | |
video_conferencing_zoom_log_error( $meeting_created->message ); | |
} else { | |
/** | |
* Fires after meeting has been Created | |
* | |
* @since 2.0.1 | |
* | |
* @param meeting_id , Host_id | |
*/ | |
$meeting_time = ''; | |
try { | |
if ( isset( $meeting_created->start_time ) ) { | |
$meeting_time = video_conferencing_zoom_convert_time_to_local( $meeting_created->start_time, $meeting_created->timezone ); | |
} | |
if ( isset( $meeting_created->id ) ) { | |
update_user_meta( $zoom_host_id, 'zoom_meeting_id_' . intval( $meeting_created->id ), $meeting_created->host_id ); | |
video_conferencing_zoom_update_meetings_list( $meeting_created ); | |
do_action( 'zoom_wp_after_create_meeting', $meeting_created, $meeting_time ); | |
} | |
} catch ( Exception $e ) { | |
video_conferencing_zoom_log_error( $e->getMessage() ); | |
} | |
} | |
} | |
$meeting = create_meeting_with_zoom_wordpress(); | |
$meeting_id = null; | |
if( isset( $meeting->id ) ) { | |
$meeting_id = $meeting->id; | |
} | |
// Use the $meeting_id in your code now. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment