Extension feature of IM
Update time: 2024/03/14 18:45:32
The extension feature provides some extension services related to IM, for example, reply message, quick message comment, session top, collection, and PIN session message, etc.
Reply messages
"Reply message" means reply to an existing message. As shown in following figure, if message B is the reply to message A, and message C is the reply to message B1. then B is parent message of A, and C is sub-message of B1. A is root message of B and C, so that A, B & C are called as threaded messages.
An IM message can have zero or one parent message, and zero or several sub-messages. If a message has neither parent message nor sub-message, it is called as "ordinary message". If the message has zero and above parent messages or sub-messages, it is called as "thread message". Unless otherwise stated, a message is ordinary message.
Except root message of thread message (e.g. message A in above figure), all thread message objects have 10 attributes (i.e. threadMsgFromAccount
, threadMsgToAccount
, threadMsgTime
, threadMsgIdServer
, threadMsgIdClient
& replyMsgFromAccount
, replyMsgToAccount
, replyMsgTime
, replyMsgIdServer
, replyMsgIdClient
), which represent from
, to
, time
, idServer
and idClient
of root message and parent message of thread message.
Notes: If you need to enable the feature, please contact the commercial manager.
Reply to a message
Add parameter replyMsg
when sending message
var msgA = {
scene: 'p2p',
from: 'cs2',
to: 'cs1',
time: 1589179595804,
type: 'text',
sessionId: 'p2p-cs2',
target: 'cs2',
flow: 'in',
status: 'success',
text: 'hello world!',
idClient: '1296612f2562e916be8fc4fdbc9e938e',
idServer: '2798262',
}
nim.sendText({
scene: 'p2p',
to: 'cs2',
text: 'reply hello world',
replyMsg: msgA,
done: (e, r) => console.log(e ? 'send message unsuccessfully : 'send message successfully')
})
Get thread messages list getThreadMsgs
Query server messages by idServer in batches
API Document getMsgsByIdServer
Quick message comments
Different from messages, comment only has several simple fields which can be deleted and will not be included in unread count. Quick comment model
Notes: If you need to enable the feature, please contact the commercial manager.
Add comments
You can make quick comment on a message. The same comment can be added to the same type of message only for once, and previous comment will be covered by subsequent comment.
Delete a comment
You can delete your quick comments only.
API Document: deleteQuickComment
Query quick comments list of a message
You can query in batches, that is, query comments list of multiple messages simultaneously.
API Document: getQuickComments
Collection
Add a collection
Delete collections in batch
Query collections list
Stick top session
The attribute isTop
of top session object is true
. If a session is top, its top extension field can be configured or updatedtopCustom
.
In addition to a pinned session, the feature can combine with other extension fields to implement various features, e.g. Session box and session classification.
Add a pinned session
API Document: addStickTopSession
Update extension field of a pinned session
API Document: updateStickTopSession
Delete a pinned session
API Document: deleteStickTopSession
Get a pinned session
API Document: getStickTopSessions
PIN tag of session message
You can add PIN tag to message, called as "PIN message". Subsequently, you can query all PIN messages under a session by session ID. The PIN message count of each session is limited.
Notes: If you need to enable the feature, please contact the commercial manager.