messages.getHistory

Gets back the conversation history with one interlocutor / within a chat

messages.messages#8c718e87 messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;
messages.messagesSlice#c8edce1e flags:# inexact:flags.1?true count:int next_rate:flags.0?int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;
messages.channelMessages#99262e37 flags:# inexact:flags.1?true pts:int count:int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;
messages.messagesNotModified#74535f21 count:int = messages.Messages;
---functions---
messages.getHistory#dcbb8260 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages;

Parameters

Name Type Description
peer InputPeer Target peer
offset_id int Only return messages starting from the specified message ID
offset_date int Only return messages sent after the specified date
add_offset int Number of list elements to be skipped, negative values are also accepted.
limit int Number of results to return
max_id int If a positive value was transferred, the method will return only messages with IDs less than max_id
min_id int If a positive value was transferred, the method will return only messages with IDs more than min_id
hash int Result hash

Result

messages.Messages

Possible errors

Code Type Description
401 AUTH_KEY_PERM_EMPTY The temporary auth key must be binded to the permanent auth key to use these methods.
400 BOT_METHOD_INVALID This method can't be used by a bot
400 CHANNEL_INVALID The provided channel is invalid
400 CHANNEL_PRIVATE You haven't joined this channel/supergroup
400 CHAT_ID_INVALID The provided chat id is invalid
400 PEER_ID_INVALID The provided peer id is invalid
-503 Timeout Timeout while fetching data

Related pages

Pagination in the API

How to fetch results from large lists of objects.