Layer 220
method Users
messages.initHistoryImport#34090c3b peer:InputPeer file:InputFile media_count:int = messages.HistoryImport;

Parameters

Name Type Description
Peer InputPeer The Telegram chat where the history should be imported.
File InputFile File with messages to import.
MediaCount int Number of media files associated with the chat that will be uploaded using messages. upload Imported Media.

Possible Errors

Code Type Description
400 CHAT_ADMIN_REQUIRED You must be an admin in this chat to do this.
400 IMPORT_FILE_INVALID The specified chat export file is invalid.
400 IMPORT_FORMAT_DATE_INVALID The date specified in the import file is invalid.
400 IMPORT_FORMAT_UNRECOGNIZED The specified chat export file was exported from an unsupported chat app.
400 PEER_ID_INVALID The provided peer id is invalid.
406 PREVIOUS_CHAT_IMPORT_ACTIVE_WAIT_%dMIN Import for this chat is already in progress, wait <number> minutes before starting a new one.

Gogram Example

// MessagesInitHistoryImport - positional arguments
result, err := client.MessagesInitHistoryImport(&tg.InputPeerUser{UserID: int64(123456789)}, &tg.InputFile{ID: int64(0), Parts: 1, Name: "file.dat"}, 0)
if err != nil {
    // handle error
}
// result is *tg.MessagesHistoryImport