Layer 224
MessagesSendEncrypted
Sends a text message to a secret chat.
method
Users
messages.sendEncrypted#44fa7a15 flags:# silent:flags.0?true peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage;
Parameters
| Name | Type | Description |
|---|---|---|
| Silent | flags.0?true | Send encrypted message without a notification |
| Peer | InputEncryptedChat | Secret chat ID |
| RandomId | long | Unique client message ID, necessary to avoid message resending |
| Data | bytes | TL-serialization of Decrypted Message type, encrypted with a key that was created during chat initialization |
Returns
messages.SentEncryptedMessageGogram Example
// MessagesSendEncrypted - using Params struct result, err := client.MessagesSendEncrypted(&tg.MessagesSendEncryptedParams{ Peer: &tg.InputEncryptedChat{}, RandomId: int64(1234567890), Data: []byte{0x01, 0x02, 0x03}, // Optional fields: // Silent: true, }) if err != nil { // handle error } // result is *tg.MessagesSentEncryptedMessage
Possible Errors
| Code | Type | Description |
|---|---|---|
| 400 | CHAT_ID_INVALID | The provided chat id is invalid. |
| 400 | DATA_INVALID | Encrypted data invalid. |
| 400 | DATA_TOO_LONG | Data too long. |
| 400 | ENCRYPTION_DECLINED | The secret chat was declined. |
| 500 | MSG_WAIT_FAILED | A waiting call returned an error. |
| 403 | USER_IS_BLOCKED | You were blocked by this user. |