Get previous messages for 24 hours time frame on load

How could I get all previous messages for the last 24 hours, for example. I am using getMessagesByTimestamp and params.nextResultSize, but with this parameter I will limit number of previous messages to display. However, I would love to display ALL message from given timestamp.

There is no way to fetch messages by specifying a period.
This is because navigating over hundreds of millions of messages has to be based on indexed data.

Search by timestamp or message_id.
The maximum number of messages that can be browsed at one time is 200, with no more than 100 recommended.
For example, to get messages 24 hours ago from the current time,
First, you should get 100 data by the current time and then call it again based on the oldest time (or message_id) to get 100 data each.