Send private message to any MyChat user.

 

Syntax

{
 "cmd"       : "0002",
 "ServerKey" : "iddqd",
 "APIStype"  : "mydata",
 "сontext"   : "myfunc",
 "UserFrom"  : "0",
 "UserTo"    : "[email protected]",
 "Msg"       : "bla-bla-bla"

 "MsgType"   : 1
}


If "UserFrom" and "UserTo" Must not match (you can't send messages to yourself).


Example of browser adress line

http://192.168.10.1:8080/API/?data={"cmd":"0002","UserFrom":0,"UserTo":"[email protected]","MsgType":1,"Msg":"Hello from browser","APIStype":"mydata","context":"myfunc","ServerKey":"iddqd"}

 

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;

context

string

optional parameter, any text that returns in a response command;

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",
  "context" : "myfunc",
  "UINTo"   : 17,
  "State"   : 0
}


Field

Type

Value

cmd

string

command HEX number that was successfully executed;

context

string

any text sent to the server in a query command;

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

#17, MCIAPI_Error_CantSendMessageToSelf

#21, MCIAPI_Error_WrongData

 

See also

0004:MCIAPI_CS_SendChannelMessage

0008:MCIAPI_CS_AddBBSMessage