Link Search Menu Expand Document

Method: messages.searchGlobal

Back to methods index

Search for messages and peers globally

Parameters:

NameTypeDescriptionRequired
folder_idintPeer folder ID, for more info click hereOptional
qstringQueryYes
filterMessagesFilterGlobal search filterOptional
min_dateintIf a positive value was specified, the method will return only messages with date bigger than min_dateOptional
max_dateintIf a positive value was transferred, the method will return only messages with date smaller than max_dateOptional
offset_rateintInitially 0, then set to the next_rate parameter of messages.messagesSliceOptional
offset_peerUsername, chat ID, Update, Message or InputPeerOffsets for pagination, for more info click hereOptional
offset_idintOffsets for pagination, for more info click hereOptional
limitintOffsets for pagination, for more info click hereOptional

Return type: messages.Messages

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();

// PHP 8+ syntax, use an array on PHP 7.
$messages_Messages = $MadelineProto->messages->searchGlobal(folder_id: int, q: 'string', filter: MessagesFilter, min_date: int, max_date: int, offset_rate: int, offset_peer: InputPeer, offset_id: int, limit: int, );