Skip to content

getChatHistory

Sahri Riza Umami edited this page Dec 8, 2016 · 3 revisions

Returns messages in a chat.

getChatHistory(chat_id, from_message_id, offset, limit)

Automatically calls openChat.
Returns result in reverse chronological order, i.e. in order of decreasing message.message_id.

If offset is negative, limit must be greater than -offset.
There may be less than limit messages returned even the end of the history is not reached.

Option Description
chat_id Chat identifier.
from_message_id Identifier of the message near which we need a history, you can use 0 to get results from the beginning, i.e. from oldest to newest.
offset Specify 0 to get results exactly from from_message_id or negative offset to get specified message and some newer messages.
limit Maximum number of messages to be returned, should be positive and can't be greater than 100.

Example

getChatHistory(1234567890, 0, 0, 17)

Test script
Frequently Asked Questions
The Functions

Clone this wiki locally