About Chat history

Hello , is there anyone help me to get all channels?
and for every channel get the history of messages for the 2 users I used for now conversation channel , So I want to get the messages I already sent and the other user sent it to me ?
How can make it please ?

To query channels: you can use Amity API to query channels with filter = all, and use Amity API to get messages in that particular channel.

In This API

what is this used for ?

  "after": 1,
  "first": 100,
  "before": 1,
  "last": 100,
  "token": "string"

This JSON snippet serves as a configuration for specifying the range, ordering, and pagination of data. Let’s break down each component:

  1. "after": 1: This indicates that the pagination should start after the first item. In other words, it specifies the starting point for retrieving data after the first item.
  2. "first": 100: This specifies the maximum number of items to be retrieved in a single request. In this case, it indicates that up to 100 items should be fetched.
  3. "before": 1: This is used for pagination to specify that data should be retrieved before the specified item. In this case, it indicates that data should be fetched before the first item.
  4. "last": 100: Similar to "first", this specifies the maximum number of items to be retrieved, but in this case, it’s from the end of the dataset.
  5. "token": "string": This is a pagination token, you can see more detail here: https://docs.amity.co/technical-faq#i-received-the-error-query-token-is-invalid-what-should-i-pass-as-the-query-token-in-swagger

Putting it all together, if you have a dataset of 100 messages and you want to paginate through them, you can use this configuration to specify how to navigate through the data. For instance, you can retrieve the first 100 messages using "first": 100, then continue from where you left off using the "after" or "before" tokens along with the "last": 100 or "first": 100 to retrieve subsequent pages of data.