Webhook event 'webinar.ended' continuing to return 500 error

Description/Error

I’ve setup a webhook for the webinar.ended event that pings our URL. Our URL takes the webinar UUID and does a callback to the zoom “Get Webinar Absentees” API endpoint. We’re doing this so we can get a list of registrants that didn’t attend. It’s working intermittently, and the webhook keeps firing repeatedly, often returning a 500 error in the zoom call logs.

It seems to be throwing a 404 error on the “Get Webinar Absentees” endpoint. Here’s an example of the URL being requested (using the UUID returned from the webhook): https://api.zoom.us/v2/past_webinars/GcQQNt4cSx2u1Q/e/+evzw==/absentees?page_size=300

I’m unsure what’s going on here, as it seems to work, but then keeps triggering the webhook and erroring other times.

Which Endpoint/s or Web JS SDK?


How To Reproduce

Our Event notification endpoint:

app.post("/api/webinar/ended", async (req, res) => {
  try {
    const webinar = req.body;
    const webinarAbsintees = await getWebinarAbsentees(
      webinar.payload.object.uuid
    );
    sendWebinarFollowUp(webinarAbsintees);
    res.sendStatus(200);
  } catch (e) {
    console.log('---- WEBINAR/ENDED ERROR ----')
    console.error(e)
    res.sendStatus(200);
  }
});

Our Get Webinar Absentees function:

const getWebinarAbsentees = uid => {
  const payload = {
    iss: API_KEY,
    exp: new Date().getTime() + 5000
  };
  const token = jwt.sign(payload, API_SECRET);

  const options = {
    uri:
      "https://api.zoom.us/v2/past_webinars/" +
      uid +
      "/absentees?page_size=300",
    auth: {
      bearer: token
    },
    headers: {
      "User-Agent": "Zoom-api-Jwt-Request",
      "content-type": "application/json"
    },
    json: true
  };

  return rp(options);
};

Screenshots

You can see our call logs keep retrying the same endpoing over and over, sometimes working, other times not:

Hey @twentyoverten, thanks for the detailed post.

I belive the issue is the uuid including / which messes up the url and causes a 404.

To fix this, double url encode the uuid:

As for the webhook throwing a 500, can you expand the request by clicking the arrow on the right (https://marketplace.zoom.us/user/logs)? I want to see if there is an error message.

Let me know if this helps!

Thanks,
Tommy

Thanks @tommy, just to clarify:

The UUID seems to be this: GcQQNt4cSx2u1Q/e/+evzw==

You want me to double URL encode it, so would that mean just:

escape(encodeURIComponent('GcQQNt4cSx2u1Q/e/+evzw=='))

Which results in: GcQQNt4cSx2u1Q%252Fe%252F%252Bevzw%253D%253D

Is that correct?

And here is the webhook 500 request:

Hey @twentyoverten,

Yes :slight_smile:

Thanks for sharing the webhook request, with the “Read timed out” error I am guessing it’s caused because you are not sending the response back to Zoom within a few seconds.

I updated your code, try this and let me know if you still get a 500 error:

app.post("/api/webinar/ended", async (req, res) => {
res.sendStatus(200);
  try {
    const webinar = req.body;
    const webinarAbsintees = await getWebinarAbsentees(
      encodeURIComponent(encodeURIComponent(webinar.payload.object.uuid))
    );
    sendWebinarFollowUp(webinarAbsintees);
  } catch (e) {
    console.log('---- WEBINAR/ENDED ERROR ----')
    console.error(e)
  }
});

Thanks,
Tommy

1 Like

Thanks @tommy! That all makes sense.

Only thing missing in the code you updated is wrapping that uuid var in the double url encode right?

I’ll give this a go and let you know if I run into any more issues!

1 Like

Happy to help @twentyoverten!

Correct, I will update the code :slight_smile:

(also fyi js escape is deprecated, use encodeURIComponent(encodeURIComponent('GcQQNt4cSx2u1Q/e/+evzw=='))

Let me know if this works / doesn’t work!

Thanks,
Tommy

1 Like

@tommy unfortunately that didn’t work :frowning:

Immediately got an error on the server:

body: { code: 3001, message: 'Meeting ID is invalid or not end.' } } }

You can see this was the URL requested with teh double encode:

https://api.zoom.us/v2/past_webinars/GcQQNt4cSx2u1Q%252Fe%252F%252Bevzw%253D%253D/absentees?page_size=300

On the flipside @tommy I don’t see a 500 error from the webhook this time!

1 Like

Did you see my other response above though @tommy?

Yes I did @twentyoverten, currently debugging. I will get back to you asap.

Thanks,
Tommy

Hey @twentyoverten, I was able to reproduce the error:

{ code: 3001, message: 'Meeting ID is invalid or not end.' }

I think this is a bug in on our side, and I will have the team investigate.

As a work around, I tried using the webinar id instead of webinar uuid and it worked!

Try using the webinar id and let me know if you get the proper response! :slight_smile:

Thanks,
Tommy

1 Like

Thanks @tommy! Should I still be double URL encoding this when using the ID?

For what it’s worth I just tried again with the UUID still in place and it worked, but this was with the following UUID being double encoded (you’ll notice it doesn’t have any forward slashes, so unsure if this is just working properly because this instance didn’t have any by chance):

8vTMUilzTm2gfzOkoHT58w==

Let me know your thoughts!

1 Like

Happy to help @twentyoverten,

When just using the ID, you don’t have to double encode :slight_smile:

Interesting! Double encoding the UUID should work with or without the forward slashes. I will debug this with our team. To confirm, does the double encoded UUID with slashes still not work?

Thanks,
Tommy

Thanks @tommy!

I’m not sure if it works with forward slashes + the double encoding, as the webinar I tested with didn’t return a UUID with a forward slash in it. I can test a few more times with other webinars to see if I get one with a forward slash to see if it works!

1 Like

Sounds good @twentyoverten!

I know we are working on removing the forward slashes in future generated UUIDs.

Keep an eye on our change log for the release that has this fix.

Thanks,
Tommy

1 Like