messages.sendMessage

Sends a text message.

messages.sentMessage#d1f4d35c id:int date:int pts:int seq:int = messages.SentMessage;
messages.sentMessageLink#e9db4a3f id:int date:int pts:int seq:int links:Vector<contacts.Link> = messages.SentMessage;
---functions---
messages.sendMessage#4cde0aab peer:InputPeer message:string random_id:long = messages.SentMessage;

Params

peer InputPeer User or chat where a message will be sent
message string Message text
random_id long Unique client message ID required to prevent message resending

Result

messages.SentMessage

Query example

(messages.sendMessage (inputPeerSelf) "Hello, me!" 12345678901)
=
(messages.sentMessage
  id:1
  date:1372403018
  pts:2
  seq:1
)

4cde0aab 7da07ec9 6c65480a 202c6f6c 0021656d dfdc1c35 00000002 c91e0aba
=
d1f4d35c 00000001 51cd354a 00000002 00000001

Return errors

Code Type Description
400 BAD_REQUEST PEER_ID_INVALID Invalid peer
400 BAD_REQUEST MESSAGE_EMPTY Empty or invalid UTF8 message was sent
400 BAD_REQUEST MESSAGE_TOO_LONG Message was too long.
Current maximum length is 4096 UTF8 characters