Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Zoom webhook RECORDING_MEETING_COMPLETED workaround
<?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;
}
}

Hi @joshuawoodward, I believe there is a typo on line 22: "swtich" instead of switch() :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment