LANYINGDevelopers
Web & Mini ProgramiOSAndroidC++Server API

5 Message processing#

5.1 Send read receipt#

GET /message/ack

Request Header#

ParameterData TypeRequiredDescription
access-tokenstringfalseToken
app_idstringtrueApp ID
group_idint64falseThis field can be set only if access-token is an Admin token, means call this interface as an Admin for this group ID
user_idint64falseThis field can be set only if access-token is a user token, means call this interface as a group member for this user ID

Query Param#

ParameterData TypeRequiredDescription
conversation_idint64falseSessionID
device_snint32falseDevice serial number
msg_idint64falseMessageID

Response Body#

● 200 Response data format:JSON

ParameterTypeDescription
codeint32Response code; 200 indicates success
databooleanResult data
messagestringError information, null means success

Interface Description#

5.2 Broadcast a message#

POST /message/broadcast

Request Header#

ParameterData TypeRequiredDescription
access-tokenstringfalseToken
app_idstringtrueApp ID
group_idint64falseThis field can be set only if access-token is an Admin token, means call this interface as an Admin for this group ID
user_idint64falseThis field can be set only if access-token is a user token, means call this interface as a group member for this user ID

Request Body#

ParameterData TypeRequiredDefaultDescription
attachmentstringfalse
configstringfalse
contentstringfalse
content_typeint32trueMessage types: TEXT = 0;
IMAGE = 1;
AUDIO = 2;
VIDEO = 3;
FILE = 4;
LOCATION = 5;
COMMAND = 6;
extstringfalse
typeint32trueTarget type; 1 indicates a regular user

Response Body#

● 200 Response data format:JSON

ParameterTypeDescription
codeint32Response code; 200 indicates success
dataobjectResult data
⇥ send_numint64Number sent
⇥ successbooleanSuccess or not
messagestringError information, null means success

Interface Description#

5.2 Get the message for the specified session#

GET /message/conversation

Request Header#

ParameterData TypeRequiredDescription
access-tokenstringfalseToken
app_idstringtrueApp ID
group_idint64falseThis field can be set only if access-token is an Admin token, means call this interface as an Admin for this group ID
user_idint64falseThis field can be set only if access-token is a user token, means call this interface as a group member for this user ID

Query Param#

ParameterData TypeRequiredDescription
limitint32trueHow many to fetch
msg_id_startint64trueFrom which message to start pulling forward: use 0 for the latest message
opposite_idint64trueSessionID

Response Body#

● 200 Response data format:JSON

ParameterTypeDescription
codeint32Response code; 200 indicates success
dataobjectResult data
⇥ is_lastbooleanWhether it is the last message: true - there are no more messages to follow, false - there are more messages to follow
⇥ messagesarray[object]Message list
⇥⇥ attachmentstringMessage attachment: When the message type is image/voice/video/file, this field will include the file url
⇥⇥ configstringExtension fields used by the SDK layer
⇥⇥ contentstringMessage content
⇥⇥ ctypestringMessage Content Type: TEXT - Text, IMAGE - Image, AUDIO - Voice, VIDEO - Video, FILE - File, LOCATION - Location, COMMAND - Custom, FORWARD - Forward Message
⇥⇥ extstringExtension data
⇥⇥ from_xidobjectMessage sender
⇥⇥⇥ device_snint32Device serial number
⇥⇥⇥ uidint64User ID
⇥⇥ msg_idint64MessageID
⇥⇥ statusstringMessage status: UNREAD - unread, DELIVERED - delivered, READ - read
⇥⇥ timestampint64Message delivery timestamp (milliseconds)
⇥⇥ to_xidobjectMessage receiver
⇥⇥⇥ device_snint32Device serial number
⇥⇥⇥ uidint64User ID
⇥ next_msg_idint64the message ID that needs to be set to pull the messages: Set this message ID to msg_id_start of the request parameter to continue to pull the message
messagestringError information, null means success

Interface Description#

5.3 Delete the specified session for the user#

DELETE /message/conversation

Request Header#

ParameterData TypeRequiredDescription
access-tokenstringfalseToken
app_idstringtrueApp ID
group_idint64falseThis field can be set only if access-token is an Admin token, means call this interface as an Admin for this group ID
user_idint64falseThis field can be set only if access-token is a user token, means call this interface as a group member for this user ID

Query Param#

ParameterData TypeRequiredDescription
conversation_idint64trueSessionID

Response Body#

● 200 Response data format:JSON

ParameterTypeDescription
codeint32Response code; 200 indicates success
databooleanResult data
messagestringError information, null means success

Interface Description#

5.5 Get all conversations for a user#

GET /message/conversation_list

Request Header#

ParameterData TypeRequiredDescription
access-tokenstringfalseToken
app_idstringtrueApp ID
group_idint64falseThis field can be set only if access-token is an Admin token, means call this interface as an Admin for this group ID
user_idint64falseThis field can be set only if access-token is a user token, means call this interface as a group member for this user ID

Query Param#

ParameterData TypeRequiredDescription
cursorstringfalseCursor used to fetch the next page
limitint32falseItems per page; the default and maximum are 20

Response Body#

● 200 Response data format:JSON

ParameterTypeDescription
codeint32Response code; 200 indicates success
dataobjectResult data
⇥ conversationsarray[object]Conversation list
⇥⇥ conversation_idobjectConversation info
⇥⇥⇥ uidint64SessionID
⇥⇥ create_timestampint64Creation timestamp
⇥⇥ latest_msg_idint64Latest message ID
⇥⇥ update_timestampint64Most recent activity timestamp
⇥ has_morebooleanWhether more conversations are available: true means more remain; false means the end has been reached
⇥ next_cursorstringCursor used to fetch the next page
messagestringError information, null means success

Interface Description#

5.4 Send system notification#

PUT /message/notify
POST /message/notify

Request Header#

ParameterData TypeRequiredDescription
access-tokenstringfalseToken
app_idstringtrueApp ID
group_idint64falseThis field can be set only if access-token is an Admin token, means call this interface as an Admin for this group ID
user_idint64falseThis field can be set only if access-token is a user token, means call this interface as a group member for this user ID

Request Body#

ParameterData TypeRequiredDefaultDescription
attachmentstringfalseAttachment: This field needs to be set if the message type is image/voice/video/file.:{"url":"https://xxx" ,"dName":"1658890327124.amr","fLen":1670,"duration":1}{"url":"https://xxx" ,"dName":"1646751218948","fLen":508728,"width":828.0,"height":828.0}
configstringfalseExtension fields used by the SDK
contentstringtrueMessage content
content_typeint32trueMessage type TEXT = 0;
IMAGE = 1;
AUDIO = 2;
VIDEO = 3;
FILE = 4;
LOCATION = 5;
COMMAND = 6;
FORWARD = 7;
extstringfalseExtension data
from_user_idint64falseSender's user ID
online_onlybooleanfalseWhether to deliver only to online users (default: false): true delivers only to online users; false delivers to both online and offline users.
related_midint64falseID of the message affected by the operation. Set this field for READ_ACK or RECALL to identify the message being marked as read or recalled.
targetsarray[int64]trueReceive user ID or group ID
transaction_idint64falseRequest ID used for deduplication. If two requests with the same transaction_id arrive within a short period, the second request is ignored. Requests are not deduplicated when this field is omitted.
typeint32trueTarget type: 1 for a user, 2 for a group.

Response Body#

● 200 Response data format:JSON

ParameterTypeDescription
codeint32Response code; 200 indicates success
databooleanResult data
messagestringError information, null means success
msg_idsarray[int64]Message ID list; message IDs are currently returned only when there is one recipient

Interface Description#

5.5 Revoke message#

PUT /message/recall
POST /message/recall

Request Header#

ParameterData TypeRequiredDescription
access-tokenstringfalseToken
app_idstringtrueApp ID
group_idint64falseThis field can be set only if access-token is an Admin token, means call this interface as an Admin for this group ID
user_idint64falseThis field can be set only if access-token is a user token, means call this interface as a group member for this user ID

Request Body#

ParameterData TypeRequiredDefaultDescription
conversation_idint64trueSessionID
msg_idint64trueMessageID

Response Body#

● 200 Response data format:JSON

ParameterTypeDescription
codeint32Response code; 200 indicates success
databooleanResult data
messagestringError information, null means success

Interface Description#

5.6 Send a message#

PUT /message/send
POST /message/send

Request Header#

ParameterData TypeRequiredDescription
access-tokenstringfalseToken
app_idstringtrueApp ID
group_idint64falseThis field can be set only if access-token is an Admin token, means call this interface as an Admin for this group ID
user_idint64falseThis field can be set only if access-token is a user token, means call this interface as a group member for this user ID

Request Body#

ParameterData TypeRequiredDefaultDescription
attachmentstringfalseAttachment: This field needs to be set if the message type is image/voice/video/file.:{"url":"https://xxx" ,"dName":"1658890327124.amr","fLen":1670,"duration":1}{"url":"https://xxx" ,"dName":"1646751218948","fLen":508728,"width":828.0,"height":828.0}
configstringfalseExtension fields used by the SDK
contentstringtrueMessage content
content_typeint32trueMessage type TEXT = 0;
IMAGE = 1;
AUDIO = 2;
VIDEO = 3;
FILE = 4;
LOCATION = 5;
COMMAND = 6;
FORWARD = 7;
extstringfalseExtension data
from_user_idint64falseSender's user ID
online_onlybooleanfalseWhether to deliver only to online users (default: false): true delivers only to online users; false delivers to both online and offline users.
related_midint64falseID of the message affected by the operation. Set this field for READ_ACK or RECALL to identify the message being marked as read or recalled.
targetsarray[int64]trueReceive user ID or group ID
transaction_idint64falseRequest ID used for deduplication. If two requests with the same transaction_id arrive within a short period, the second request is ignored. Requests are not deduplicated when this field is omitted.
typeint32trueTarget type: 1 for a user, 2 for a group.

Response Body#

● 200 Response data format:JSON

ParameterTypeDescription
codeint32Response code; 200 indicates success
databooleanResult data
messagestringError information, null means success
msg_idsarray[int64]Message ID list; message IDs are currently returned only when there is one recipient

Interface Description#

5.7 Get the list of recent sessions for the specified user#

GET /message/unread

Request Header#

ParameterData TypeRequiredDescription
access-tokenstringfalseToken
app_idstringtrueApp ID
group_idint64falseThis field can be set only if access-token is an Admin token, means call this interface as an Admin for this group ID
user_idint64falseThis field can be set only if access-token is a user token, means call this interface as a group member for this user ID

Response Body#

● 200 Response data format:JSON

ParameterTypeDescription
codeint32Response code; 200 indicates success
dataarray[object]Result data
⇥ conversation_idobjectConversation info
⇥⇥ uidint64SessionID
⇥ numint32Unread message-number
messagestringError information, null means success

Interface Description#

Generated API content with concise AI notes where context helps.