Use Webhook to count participants

Description
I am trying to track the amount of participant who are at a given time in a meeting. For this I am using a webhook, which receives the participant_joined and participant_left events.

On the first event, a participants user_id is added to a list, on the second event the participant’s user_id is removed from the list. The number of user_ids in the list should give the number of people in the meeting at a given time.

Error
I have implemented the scheme as described above and tried it with real-world meetings (up to 200 participants), but fairly quickly the number deviates from the actual number of participants.

As far as I can tell, the webhook method described above lists too many participants.

Is it possible that I am not receiving all events? Would there be a better method to track the number of participants?

Which App Type (OAuth / Chatbot / JWT / Webhook)?
Webhook

Hi @1llusion,

The webhooks for participant joins could vary from the unique number of participants for a few reasons. Most notably, if a participant temporarily left and rejoined or was temporarily disconnected, a new webhook would be triggered on each “re-join”.

Additionally, if there is a waiting room enabled, you might be receiving events for participants joining the waiting room and then joining the meeting.

You might also consider querying participants via API:

Thanks!
Will

Thanks Will!

Does this mean that for each of these participant_join events – which could be a re-joins – a new user_id is assigned AND not all of these have a subsequent participant_left event?

If so, it means I need to make sure that on participant_join I don’t add the user to the meeting table, if he is already in there.

So if I modify it as follows, I think it should be fairly robust:

  1. On participant_join check if participant.id is set;
    1.1 if participant.id is set, check our internal meeting table if we already have the same participant.id in there; if so, it is a re-join and we can simply update the existing entry with the new participant.user_id
    1.2 if participant.id is not set, check internal meeting table if we have a participant with participant.user_name in there; if so, this is a rejoin and thus we update (as above).

This may still fail to count properly if multiple participants who are not logged into Zoom share the same user_name, but I think this is fairly unlikely.

Do you think this would work?

Hi @1llusion,

Good questions, and overall I think this isn’t a bad approach. :slight_smile:

Regarding user_id, just keep in mind that this will not be unique for each webhook if the user is signed into their Zoom account (in this case, it will always be their own unique user_id). Otherwise, however, I think your approach will work.

Thanks!
Will

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.