Last active
August 5, 2019 07:01
-
-
Save joshuawoodward/35ee7f4b220f88b6559587cb9fbdab02 to your computer and use it in GitHub Desktop.
Zoom webhook RECORDING_MEETING_COMPLETED workaround
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
<?php | |
if( isset($_POST["type"]) ) { | |
/** | |
Currently the recording ready notification is not consistent with the other notifications. | |
The others return status, uuid, host_id, id. Recording ready returns type and content (content is a urlencoded json). | |
The below code will transform it into what is needed temporarly, without breaking your implemention when a fix is made, this block of code can latter be removed when the bug is fixed. | |
*/ | |
if($_POST["type"] === "RECORDING_MEETING_COMPLETED"){ | |
//set status to type | |
$_POST["status"] = "RECORDING_MEETING_COMPLETED"; | |
//get uuid/host_id from content | |
$json = json_decode($_POST["content"]); | |
$_POST["uuid"] = $json->uuid; | |
$_POST["host_id"] = $json->host_id; | |
} | |
} | |
if( isset($_POST["status"]) ){ | |
switch( $_POST["status"] ){ | |
case "JBH": | |
//JBH Logic | |
break; | |
case "JOIN": | |
//JOIN Logic | |
break; | |
case "STARTED": | |
//STARTED Logic | |
break; | |
case "ENDED": | |
//ENDED Logic | |
break; | |
case "RECORDING_MEETING_COMPLETED": | |
//RECORDING_MEETING_COMPLETED Logic | |
// the below is psudeo code and depends heavily on your implemention of interacting will zoom rest api | |
//implement a call out to https://api.zoom.us/v1/recording/get | |
$response = call_zoom('/v1/recording/get', array("meeting_id" => $_POST["uuid"])); | |
// response will be JSON | |
$response = json_decode($response); | |
if( $response && $response->recording_files){ | |
foreach ($response->recording_files as $recording) { | |
//check if video file, can contain audio files too | |
//note: can contain more than one video file as well, depending on length of meeting recordings may be split across files | |
if($recording->file_type === "MP4"){ | |
//implement a download funciton | |
$file = download($recording->download_url); | |
//implement where you want to store | |
upload($file); | |
} | |
} | |
} | |
break; | |
} | |
} |
@Silver-Seagull thanks!
@joshuawoodward hello! not sure if you are the right person to ask this about but where can I get some documentation related to webhooks? I'd like to see complete description of each webhook type and what data they send to my endpoint. I there something I can referencing? Example above does not look complete.
Looks like I found documentation: https://developer.zoom.us/docs/webhooks/ Will hope it is complete.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @joshuawoodward, I believe there is a typo on line 22: "swtich" instead of
switch()
:)