Programmable Chat has been deprecated and is no longer supported. Instead, we'll be focusing on the next generation of chat: Twilio Conversations. Find out more about the EOL process here.
Twilio’s Programmable Chat client SDKs use paging to improve performance when accessing potentially large collections of chat objects.
While the signature of the individual methods will vary by SDK platform, each paginator has the following accessors:
- A way to obtain the items.
- A boolean property indicating if there are subsequent pages.
- A method taking the same callback mechanism as the original call to request the next page.
The messages collection behaves a bit differently than channels and members since there is a temporal quality to how the objects are typically presented.
The messages collection objects offer the following ways to access items:
getLastMessagesfetches the specified number of messages, starting with the most recent in the collection.
getMessagesBeforefetches messages before (and including) the anchor message index specified.
getMessagesAfterfetches messages after (and including) the anchor message index specified.
messageWithConsumptionIndexfetches the message with the specified index or, if that message is no longer available, the message directly before it.
messageWithIndexfetches the message specified by the index, if available.
Next: Roles and Permissions