Support » Plugin: Video Conferencing with Zoom » Create a meeting through functions.php

  • Resolved henrikofsweden

    (@henrikofsweden)


    Hi, thanks for great plugin! 🙂

    Is it possible to create a meeting through code in functions.php?
    (I can retrieve user info and zoom user id correctly through ‘getUserInfo()’, but not create a meeting)

    I have tried this on the “wp”-action:

    function test_zoom_api(){

    $now_object = date_create(“now”, “Europe/Stockholm”);

    $user_info = json_decode(zoom_conference()->getUserInfo(“henrik@mymailadress.se”));
    $user_zoom_id = $user_info->id;

    $data = array(
    “start_date” => $now_object->format(“Y-m-d H:i”),
    “password” => “None”,
    “duration” => 60,
    “type” => 2,
    “meetingTopic” => “Test meeting”,
    “meeting_authentication” => false,
    “agenda” => “Test agenda”,
    “timezone” => “Europe/Stockholm”,
    “disable_waiting_room” => “yes”,
    “option_host_video” => true,
    “option_participants_video” => true,
    “userId” => $user_zoom_id
    );

    $new_meeting = json_decode(zoom_conference()->createAMeeting($data));
    }

    No new meeting is created in zoom or anywhere in wordpress.
    $new_meeting is Null afterwards.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Deepen

    (@j_3rk)

    @henrikofsweden

    I tested the code and with a few tweaks below should work:

    function test_zoom_api() {
    
    	$now_object = date_create( "now", new dateTimezone( "Europe/Stockholm" ) );
    	$user_info    = json_decode( zoom_conference()->getUserInfo( "youremail@email.com" ) );
    	$user_zoom_id = $user_info->id;
    
    	$data = array(
    		"start_date"                => $now_object->format( "Y-m-d H:i" ),
    		"password"                  => "",
    		"duration"                  => 60,
    		"type"                      => 2,
    		"meetingTopic"              => "Manual Meeting create Test",
    		"meeting_authentication"    => false,
    		"agenda"                    => "Test agenda",
    		"timezone"                  => $now_object->getTimezone()->getName(),
    		"disable_waiting_room"      => "yes",
    		"option_host_video"         => true,
    		"option_participants_video" => true,
    		"userId"                    => $user_zoom_id
    	);
    	$new_meeting = json_decode( zoom_conference()->createAMeeting( $data ) );
    	#dump($new_meeting);
    }
    
    add_action( 'wp', 'test_zoom_api' );

    Please note that above code will only create the meeting in Zoom and this can be viewed from wp-admin > Zoom Meeting > Live meetings page or directly from Zoom.

    • This reply was modified 2 months, 2 weeks ago by Deepen.
    Thread Starter henrikofsweden

    (@henrikofsweden)

    That worked! I suppose it was mainly the timezone that I got wrong.

    Thanks a million Deepen – great support. I’ll go pro version as soon as I need anything there.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.