Message History
Fetch messages using ALO's fetchHistory and fetchHistoryAround methods.
Fetch messages in reverse chronological order
You can use the fetchHistory
method to fetch messages in reverse chronological order (from newest to oldest). fetchHistory
also makes it easy to paginate through history in the direction of your choice.
fetchHistory({ channelId: string, ... })
fetchHistory({ channelId: string, ... })
Name
Type
Required
Description
channelId
string
yes
The channel to fetch messages from.
limit
integer
no
The maximum number of messages to fetch (defaults to 100).
olderPageToken
string
no
The olderPageToken
will be populated in the response offetchHistory
if there exist messages sent before the current batch of retrieved messages (older messages).
newerPageToken
string
no
The newerPageToken
will be populated in the response of fetchHistory
if there exist messages sent after the current batch of retrieved messages (newer messages).
Fetch messages centered around a specific message
The fetchHistoryAround
method gives you the ability to jump back into history to a specific message and retrieve the messages that were sent immediately before and after it.
fetchHistoryAround({ channelId: string, messageId: string, ... })
Name
Type
Required
Description
channelId
string
yes
The id of the channel for which you want to fetch history.
messageId
string
yes
The message for which you want to fetch history around.
limit
integer
no
The number of messages in both directions you want to fetch. For example, if you set limit
to 5, you will receive a maximum of 11 messages: 5 messages before, the messageId
message, and 5 message after. Defaults to 100.
Last updated