SendEncryptedServiceRequest

Only users can use this request. See code examples.

---functions---
messages.sendEncryptedService#32d439a4 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage

Returns

messages.SentEncryptedMessage

This type can be an instance of either:

SentEncryptedFileSentEncryptedMessage

Parameters

peerInputEncryptedChat
databytes
random_idlongIf left unspecified, it will be inferred automatically.

Known RPC errors

This request can cause 4 known errors:

DataInvalidErrorEncrypted data invalid.
EncryptionDeclinedErrorThe secret chat was declined.
MsgWaitFailedErrorA waiting call returned an error.
UserIsBlockedErrorUser is blocked.

You can import these from telethon.errors.

Example

from telethon.sync import TelegramClient
from telethon import functions, types

with TelegramClient(name, api_id, api_hash) as client:
    result = client(functions.messages.SendEncryptedServiceRequest(
        peer=types.InputEncryptedChat(
            chat_id=478614198,
            access_hash=-12398745604826
        ),
        data=b'arbitrary\x7f data \xfa here'
    ))
    print(result.stringify())