Link Search Menu Expand Document

Method: messages.getSavedHistory

Back to methods index

Returns saved messages » forwarded from a specific peer

Parameters:

NameTypeDescriptionRequired
peerUsername, chat ID, Update, Message or InputPeerTarget peerOptional
offset_idintOnly return messages starting from the specified message IDOptional
offset_dateintOnly return messages sent before the specified dateOptional
add_offsetintNumber of list elements to be skipped, negative values are also accepted.Optional
limitintNumber of results to returnOptional
max_idintIf a positive value was transferred, the method will return only messages with IDs less than max_idOptional
min_idintIf a positive value was transferred, the method will return only messages with IDs more than min_idOptional
hashArray of long|stringResult hashOptional

Return type: messages.Messages

Can userbots use this method: YES

Can bots use this method: NO

MadelineProto Example (now async for huge speed and parallelism!):

if (!file_exists('madeline.php')) {
    copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
}
include 'madeline.php';

$MadelineProto = new \danog\MadelineProto\API('session.madeline');
$MadelineProto->start();

$messages_Messages = $MadelineProto->messages->getSavedHistory(peer: $InputPeer, offset_id: $int, offset_date: $int, add_offset: $int, limit: $int, max_id: $int, min_id: $int, hash: [$long\|string, $long\|string], );