MyChat Integration API: MCIAPI_CS_SendPrivateMessage, send a private message

MyChat Integration API: MCIAPI_CS_SendPrivateMessage, send a private message

Send private message to any MyChat user.

 

Syntax

{

 "cmd"       : "0002",

 "ServerKey" : "iddqd",

 "APIStype"  : "mydata",

 

 "UserFrom"  : "0",

 "UserTo"    : "user@test.com",

 "Msg"       : "bla-bla-bla"

}

 

If "UserFrom" and "UserTo" matches (you send messages to yourself), a sender will be replaced with UIN=0 (built-in bot).

 

Parameters

Parameter

Type

Value

cmd

string

"0002", the number of the command  MCIAPI_CS_SendPrivateMessage;

ServerKey

string

Integration API key, can be set in the server settings;

APIStype

string

integration type. You can set any string;

UserFrom

string

user-sender. "0" by default. You can set UIN, email, or a user nickname;

UserTo

string

message recipient. You can set UIN, email, or a user nickname;

Msg

string

message text.

MsgType

integer

message type, unnecessary parameter. If a message type is not a simple text, then JSON object or multi-line text will be in Msg.

 

Work result

{

 "cmd"   : "0002",

 "State" : 0,

 "UINTo" : 17

}

 

Field

Type

Value

cmd

string

command HEX number that was successfully executed;

State

integer

current network status of a message recipient;

UINTo

integer

unique identifier of a message recipient, UIN.

 

Possible errors

#2, MCIAPI_Error_WrongSenderUser

#3, MCIAPI_Error_WrongReceiverUser

#4, MCIAPI_Error_EmptyMessage

#5, MCIAPI_Error_WrongIntegrationKey

#11, MCIAPI_Error_WrongDomainUserReceiver

#12, MCIAPI_Error_WrongDomainUserSender

 

See also

0004:MCIAPI_CS_SendChannelMessage

0008:MCIAPI_CS_AddBBSMessage