Link Search Menu Expand Document

Method: messages.initHistoryImport

Back to methods index

Import chat history from a foreign chat app into a specific Telegram chat, click here for more info about imported chats ».

Parameters:

NameTypeDescriptionRequired
peerUsername, chat ID, Update, Message or InputPeerThe Telegram chat where the history should be imported.Optional
fileFile path or InputFileFile with messages to import.Yes
media_countintNumber of media files associated with the chat that will be uploaded using messages.uploadImportedMedia.Optional

Return type: messages.HistoryImport

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_HistoryImport = $MadelineProto->messages->initHistoryImport(peer: InputPeer, file: InputFile, media_count: int, );