messages.initHistoryImport
Import chat history from a foreign chat app into a specific Telegram chat, click here for more info about imported chats ».
func (c *Client) MessagesInitHistoryImport(ctx context.Context, request *MessagesInitHistoryImportRequest) (*MessagesHistoryImport, error)
Calling this method
client.Run(ctx, func(ctx context.Context) error {
api := client.API()
res, err := api.MessagesInitHistoryImport(ctx, &tg.MessagesInitHistoryImportRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // *MessagesHistoryImport
return nil
})
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
Peer | InputPeerClass | yes | The Telegram chat where the history should be imported. |
File | InputFileClass | yes | File with messages to import. |
MediaCount | int | yes | Number of media files associated with the chat that will be uploaded using messages uploadImportedMedia. |
Returns
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. |
| 400 | USER_NOT_MUTUAL_CONTACT | The provided user is not a mutual contact. |
References
- Official documentation
- Generated Go reference
- TL definition:
messages.initHistoryImport#34090c3b