Fetche specified messgae

I want to get all history messages from the specified time to now,like the fetchNext() method,but this method only can fetch all the offline messages.

Hello @jusy,
You can use the setTimestamp() method of the MessagesRequestBuilder class and set the time after which you wish to fetch the messages in the form of unix timestamp and then call the fetchNext() method.

Hope this helps.Thanks

1 Like

Hello @aditya.gokula ,
I’m a little confused,Show in the document that use the fetchNext() method can get offline messages,and use the fetchPrevious() method to get all history message.
Whether the fetchNext() method is also effective for all history message?
Thanks.

Hello @jusy,
The basic concept behind fetchPrevious() and fetchNext() methods is that fetchPrevious() method fetches messages before the specified parameters and fetchNext() method fetches messages after the specified parameters.
For example:
if you use the setTimestamp() method and call the fetchNext() method, it will provide you the messages after the specified timestamp.
if you use the setTimeStamp() method and call the fetchPrevious() method, it will provide you with the messages before the specified timestamp

This is how the fetchPrevious() and fetchNext() methods work with all the other parameters too.
Hope this helps.
Thanks

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.