Next Page Token Issue

Strange behaviour with pagination. My request is returning accurate next page tokens which seem to be used in subsequent requests, but the response is repeating the first page over and over instead of the next page of data. I’m using GAS and this is part of an automated attendance flow. However this is a huge issue as we are not able to fetch participants last leave time, thus we are unable to accurately track attendance.

function processPageData(next_page_token, previous_page_token = “”) {
// If we’ve processed all participants, return immediately
if (participants_processed_count >= fullMeetingData.participants_count) {
console.log(“All participants processed, breaking the loop.”);

// Fetching a single page of participant data
var pageData = getZoomMeetingReportPageData(todaysInstance.uuid, next_page_token);

// Log the current and previous next_page_token
console.log(`Previous next_page_token: ${previous_page_token}`);
console.log(`New next_page_token from current response: ${pageData.next_page_token}`);

// Process the exact number of participants' data returned by the API
processMeetingParticipantsPageData(fullMeetingData, pageData, participantToDurationMap, pageData.participants.length);

// Update participants_processed_count
participants_processed_count += pageData.participants.length;

// Log the current state of the loop
console.log(`Processed ${participants_processed_count} out of ${fullMeetingData.participants_count} participants.`);

// Check if the next_page_token exists and is different from the previous one
if (pageData.next_page_token && pageData.next_page_token !== previous_page_token) {
    processPageData(pageData.next_page_token, next_page_token);
} else {
    console.log("No new next_page_token received or same token received. Exiting recursion.");


function getZoomMeetingReportPageData(meetingUUID, next_page_token) {
// Double check encoding
var encodedUUID = encodeURIComponent(meetingUUID);
var url =${encodedUUID}/participants?page_size=50&page_token=${next_page_token};

Logger.log('Request URL: ' + url);  // Log the request URL

// (Sensitive part related to authorization removed for security)
var options = {
    'headers': {
        'Authorization': 'Bearer ' + '[YOUR_ZOOM_ACCESS_TOKEN]'

var response = UrlFetchApp.fetch(url, options);

if (response.getResponseCode() !== 200) {
    Logger.log('Error fetching data from Zoom API. Response Code: ' + response.getResponseCode());
    throw new Error('Error fetching data from Zoom API.');

var jsonData = JSON.parse(response.getContentText());

if (jsonData && jsonData.participants) {
    Logger.log(`Received ${jsonData.participants.length} participants from Zoom API for this page.`);
    if (jsonData.participants.length > 0) {
        Logger.log(`First participant of the page: ${jsonData.participants[0].name}`);
        Logger.log(`Last participant of the page: ${jsonData.participants[jsonData.participants.length - 1].name}`);
} else {
    Logger.log('Unexpected response format from Zoom API or failed request.');

// Checking for duplicate participants
var namesEncountered = new Set();
jsonData.participants.forEach(participant => {
    if (namesEncountered.has( {
        Logger.log(`Duplicate participant found: ${}`);
    } else {

var participantsData = {};
for (var i = 0; i < jsonData.participants.length; i++) {
    var participant = jsonData.participants[i];
    if (participantsData[]) {
        participantsData[].join_time = Math.min(participantsData[].join_time, new Date(participant.join_time).getTime());
        participantsData[].leave_time = Math.max(participantsData[].leave_time, new Date(participant.leave_time).getTime());
    } else {
        participantsData[] = {
            'join_time': new Date(participant.join_time).getTime(),
            'leave_time': new Date(participant.leave_time).getTime()

jsonData.participantsData = participantsData;

return jsonData;


Hi @jeffblackwood86
Thanks for reaching out to us! I am happy to help here!
So basically, when you get a next_page_token and you use it to get the rest of the data, the requests bring back the exact same data? it is not bringing you the next records in the response?
Also is this an issue that just started or have you been noticing this in the past?

Hi @elisa.zoom,

Thank you so much for your reply. It has behaved this way since the beginning, and it is the last hurdle before this automated attendance app will be fully functional. It seems to just provide the same first page over and over again even though the next page tokens are different.

Any suggestions or insights would be appreciated! I am knew to coding but trying to learn as best I can.

Thank you again,

Interesting, @jeffblackwood86
Here is a helpful post on how to handle next_page_token with recursion

I will also go ahead and send you a private message to get more details about your specific case