Get participants total duration and Actions Callbacks

Hello;
I’m building online training platform that involve 3 parties: Student, Trainer, Supervisors. I have already finished all stages and everything is working manually absolutely fine. I need to automate creating meetings and some reporting data between my project and Zoom services.
I have read a lot in API documentation, but I still feel a little lost.
Currently, I’m building my API calls based on the code by paezraphael in https://github.com/paezraphael/sample-app-php suggested in PHP SDK for REST API V2 and I have 3 questions.

1- Is there a callback URL that I can set in my application or account to notify my system when participant joins or leave meeting? Current solution I have in mind - but I don’t think it’s very reliable one - is recursively getting meeting information until finding participant join and leave information.

2- I want to make joining meeting exclusive to Trainer, Teacher and supervisors. Is that possible? In case it is, what information should I have about users to do that? Eg. Zoom email address?
Please note that I need attendance information for both Trainer and Teacher and in that case depending on Meeting Id and password won’t be reliable in my case since it can be shared by trainer for example and not allowing trainers to enter before host (Teacher) isn’t reliable as well since in case Teacher was absent I won’t be able to track if the student attended or not.

3- I’m trying to retrieve participants actual total duration during meeting.
I found that /metrics/meetings/{meetingId}/participants shows the meeting participants join and leave time. But what happens in case the internet was disconnected from 1 of the participants for some time? Will that call show me total number of joining and leaving the meeting due to internet connection interruptions?

Best Regards

Hey @darsh, thanks for posting and using Zoom!

Yes! Use our Webhooks or Event Subscriptions which can be added to OAuth or JWT app types to be notified when a Participant Joins, or Leaves a meeting.

For limiting who can and cannot join a meeting, implement meeting registration. This can be done on the Zoom Web Portal, or via our API). When a user registers, you can check your backend if that user is a Trainer, Teacher, or Supervisor, then respectively approve or deny them to be in the meeting.

If the participant is discounted due to internet issues, the leave_time will reflect correctly, as well as the leave_reason stating why the participant left, for example: “Internet Issues”.

Let me know if you have any other questions! :slight_smile:

Thanks,
Tommy

1 Like

Hey @tommy, thank you very much for your answers.
I could find a way using OAuth to get users information to register their user Ids in my database and use it later for meetings registration as suggested by you.
I have another question if you let me. Is there a way to allow individuals to connect their accounts using JWT application, or is it exclusive feature for OAuth application?
Currently I’m using OAuth for connecting users (Registering their user Ids in my database) and JWT to manage my own account (Meetings registration, Reports … etc ).
Is that alright?
I will post code used in callback page (redirect_uri) in case someone else needs it.

if(isset($_REQUEST['code']))
{

code = _REQUEST[‘code’];
$token_url = ‘https://zoom.us/oauth/token?grant_type=authorization_code&code=’.$code.’&redirect_uri=’.urlencode($redirect_uri);
$options = array(
‘http’ => array(
‘header’ => "Authorization: Basic ".base64_encode($client_id.’:’.$client_secret),
‘method’ => ‘POST’
)
);
$context = stream_context_create($options);
$reponse = file_get_contents($token_url, false, $context);
$params = json_decode($reponse);
$access_token = $params->access_token;
$user_url = ‘https://api.zoom.us/v2/users/me?access_token=’.$access_token;
$reponse = file_get_contents($user_url);
$user = json_decode($reponse);
var_dump($user);

Hey @darsh, happy to help!

You can only access your Zoom account, or other users on your Zoom account with a JWT App. In order for people outside your Zoom account to use your application, you need to use an OAuth App.

Yes that is perfectly fine!

Let me know if you have any other questions! :slight_smile:

Thanks,
Tommy

1 Like

Thank you @tommy for your answers. I really appreciate it.

I understood that if you participant got disconnected so leave time will be updated. But what if participant was connected again then 5 minutes later he was reconnected then 10 minutes later he got disconnected again.
Will all these data be included in participant data when I call /metrics/meetings/{meetingId}/participants or in this case events subscriptions will be best solution?

1 Like

Hey @darsh, you are welcome!

If this happens, then you will see a separate record for each time the participant joined/left. For example when I had the same user join / leave, then join / leave again, there are two records for the user with the same id: 88CCc8_KQNebfLX7rvnFwQ:

{
    "page_count": 1,
    "page_size": 30,
    "total_records": 3,
    "next_page_token": "",
    "participants": [
        {
            "id": "KdYKjnimT4KPd8KKdQt9FQ",
            "user_id": "16778240",
            "user_name": "Tommy Gaessler",
            "device": "Web",
            "ip_address": "63.233.134.130",
            "location": "Castle Rock (US)",
            "network_type": "Others",
            "microphone": "wclaudi",
            "camera": "webcam",
            "data_center": "DV (Top)",
            "connection_type": "UDP",
            "join_time": "2019-12-17T18:32:13Z",
            "leave_time": "2019-12-17T18:33:38Z",
            "share_application": false,
            "share_desktop": false,
            "share_whiteboard": false,
            "recording": false,
            "pc_name": "",
            "domain": "",
            "mac_addr": "",
            "harddisk_id": "",
            "version": "4.0.426.1118.ffde97c8",
            "leave_reason": "Tommy Gaessler left the meeting.<br>Reason: Host ended the meeting."
        },
        {
            "id": "88CCc8_KQNebfLX7rvnFwQ",
            "user_id": "16779264",
            "user_name": "Tommy Gaessler 1",
            "device": "Mac",
            "ip_address": "63.233.134.130",
            "location": "Castle Rock (US)",
            "network_type": "Wifi",
            "microphone": "MacBook Pro Microphone (MacBook Pro Microphone)",
            "speaker": "MacBook Pro Speakers (MacBook Pro Speakers)",
            "camera": "HD Pro Webcam C920 #2",
            "data_center": "DV (Top)",
            "connection_type": "UDP",
            "join_time": "2019-12-17T18:32:33Z",
            "leave_time": "2019-12-17T18:32:54Z",
            "share_application": false,
            "share_desktop": false,
            "share_whiteboard": false,
            "recording": false,
            "pc_name": "Tommy Gaessler MacBook Pro",
            "domain": "Tommy-Gaessler-MacBook-Pro",
            "mac_addr": "38:F9:D3:96:1E:38",
            "harddisk_id": "43ED4ABB-AD9B-5CF4-BB3C-CA3680096313",
            "version": "4.6.13614.1202",
            "leave_reason": "Tommy Gaessler 1 left the meeting.<br>Reason: left the meeting."
        },
        {
            "id": "88CCc8_KQNebfLX7rvnFwQ",
            "user_id": "16780288",
            "user_name": "Tommy Gaessler 2",
            "device": "Mac",
            "ip_address": "63.233.134.130",
            "location": "Castle Rock (US)",
            "network_type": "Wifi",
            "microphone": "MacBook Pro Microphone (MacBook Pro Microphone)",
            "speaker": "MacBook Pro Speakers (MacBook Pro Speakers)",
            "camera": "HD Pro Webcam C920 #2",
            "data_center": "DV (Top)",
            "connection_type": "UDP",
            "join_time": "2019-12-17T18:33:02Z",
            "leave_time": "2019-12-17T18:33:33Z",
            "share_application": false,
            "share_desktop": false,
            "share_whiteboard": false,
            "recording": false,
            "pc_name": "Tommy Gaessler MacBook Pro",
            "domain": "Tommy-Gaessler-MacBook-Pro",
            "mac_addr": "38:F9:D3:96:1E:38",
            "harddisk_id": "43ED4ABB-AD9B-5CF4-BB3C-CA3680096313",
            "version": "4.6.13614.1202",
            "leave_reason": "Tommy Gaessler 2 left the meeting.<br>Reason: left the meeting."
        }
    ]
}

If you want this data in real time, without exceeding rate limits, I would suggest using the Participant Join / Left Meeting Webhooks.

Thanks,
Tommy

1 Like