Layer 220
method Users
messages.getHistory#4423e6c5 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:long = messages.Messages;

Parameters

Name Type Description
Peer InputPeer Target peer
OffsetId int Only return messages starting from the specified message ID
OffsetDate int Only return messages sent before the specified date
AddOffset int Number of list elements to be skipped, negative values are also accepted.
Limit int Number of results to return
MaxId int If a positive value was transferred, the method will return only messages with IDs less than max_id
MinId int If a positive value was transferred, the method will return only messages with IDs more than min_id
Hash long Result hash

Possible Errors

Code Type Description
400 CHANNEL_INVALID The provided channel is invalid.
406 CHANNEL_PRIVATE You haven't joined this channel/supergroup.
400 CHAT_ID_INVALID The provided chat id is invalid.
400 CHAT_NOT_MODIFIED No changes were made to chat information because the new information you passed is identical to the current information.
400 FROZEN_PARTICIPANT_MISSING The current account is frozen, and cannot access the specified peer.
400 MSG_ID_INVALID Invalid message ID provided.
400 PEER_ID_INVALID The provided peer id is invalid.
400 TAKEOUT_INVALID The specified takeout ID is invalid.

Gogram Example

// MessagesGetHistory - using Params struct
result, err := client.MessagesGetHistory(&tg.MessagesGetHistoryParams{
    Peer: &tg.InputPeerUser{UserID: int64(123456789)},
    OffsetId: 0,
    OffsetDate: 0,
    AddOffset: 0,
    Limit: 0,
    MaxId: 0,
    MinId: 0,
    Hash: int64(0),
})
if err != nil {
    // handle error
}
// result is *tg.MessagesMessages