Handling pagination

Product deprecation notice

Effective April 30th, 2026, Vonage In-App Messaging will no longer be available. Access for new users will be closed, and the service will be discontinued for all existing users.

If you have any questions regarding this product’s discontinuation, please contact your account manager or our support team.

This guide covers the process loading and displaying chunks of conversation events at a time.

NOTE: A step-by-step tutorial to build a chat application is available here.

Given a Conversation you are already a Member of, you can download chunks (pages) of events existing within this conversation.

Load first page of events:

function listEvents(events_page){
      events_page.items.forEach(event => {
        handleEvent(event);
      })
}

conversation.getEvents({ page_size: 100, order: 'asc' })
    .then((events_page) => {
        listEvents(events_page);
    })
    .catch((error) =>{
        console.log('Error: Unable to load conversation events ',error);
    });

After loading the first chunk of events you will get the reference to the current Events Page (JavaScript, iOS, Android). This reference allows you to retrieve following event pages:

if (events_page.hasNext()){
    listEvents(events_page.getNext());
}

Preceding pages can also be retrieved using a similar technique:

if (events_page.hasPrev()){
    listEvents(events_page.getPrev());
}

Reference