Message Reply and Conversation ThreadingEstimated reading time: 2 minutes
Conversation threading is a very useful feature that allows you to create message threads by
- Replying to messages
- Associating and Grouping a set of messages with something related to your apps (message context).
Threading by Reply
You can create a message thread by replying to messages. There is no limit on the depth of the message thread and hence you can reply to a reply and so on.
You can reply to a message by calling
setInReplyTo API of
void MessageParams.setInReplyTo(long messageId);
setInReplyTo takes the following parameters:
|messageId||The message ID of the message to reply to.|
On the receiving end, you can call
getInReplyTo() APIs of
MessageMessage to know if the message is a reply to another message.
getInReplyTo returns message-ID, or zero.
You can call
getRepliedToMessage() to get the original message
MesiboMessage origMessage = msg.getRepliedToMessage();
Threading by Context
You can also create a thread by associating messages with something related to your apps.
For example, in a buy-and-sell app, a buyer can send a message to the seller about item
A. Later, the same buyer can send another message to the same seller about item
B. Your app can then display both messages in separate threads instead of mixing them.
In another example, a telemedicine app, doctors like to pull out internal conversations related to a patient instead of all the messages. Conversation threading makes it more manageable to achieve that.
Mesibo makes it easy to associate the message to a conversation thread by setting the conversation thread ID. In the above example of a buy-and-sell app, if the item
A is represented by ID 1 and item
B is represented by ID 2. you can set the thread ID by calling
setThreadId API of
On the recipient side,
getThreadId() returns the conversation thread ID to identify the thread message belongs to.
Read Messages by Conversation Thread ID
You can retrieve the messages using Conversation Thread ID by calling calling
setThreadId API of
MesiboReadSession before calling
read(). Refer to the Reading Messages section to learn more.