Layer 220
MessagesSendEncryptedFile
Sends a message with a file attachment to a secret chat
method
Users
messages.sendEncryptedFile#5559481d flags:# silent:flags.0?true peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage;
Parameters
| Name | Type | Description |
|---|---|---|
| Flags | # | Flags, see TL conditional fields |
| Silent | flags.0?true | Whether to send the file without triggering a notification |
| Peer | InputEncryptedChat | Secret chat ID |
| RandomId | long | Unique client message ID necessary to prevent message resending |
| Data | bytes | TL-serialization of Decrypted Message type, encrypted with a key generated during chat initialization |
| File | InputEncryptedFile | File attachment for the secret chat |
Returns
messages.SentEncryptedMessagePossible Errors
| Code | Type | Description |
|---|---|---|
| 400 | CHAT_ID_INVALID | The provided chat id is invalid. |
| 400 | DATA_TOO_LONG | Data too long. |
| 400 | ENCRYPTION_DECLINED | The secret chat was declined. |
| 400 | FILE_EMTPY | An empty file was provided. |
| 400 | MD5_CHECKSUM_INVALID | The MD 5 checksums do not match. |
| 400 | MSG_WAIT_FAILED | A waiting call returned an error. |
Gogram Example
// MessagesSendEncryptedFile - using Params struct result, err := client.MessagesSendEncryptedFile(&tg.MessagesSendEncryptedFileParams{ Peer: &tg.InputEncryptedChat{}, RandomId: int64(0), Data: []byte{}, File: &tg.InputEncryptedFileUploaded{}, // Optional fields: // Silent: true, }) if err != nil { // handle error } // result is *tg.MessagesSentEncryptedMessage