0

I use read message API to get all messages for one conversation between two users. The result is the following (check image). enter image description here

How I am supposed to know what are the messages I have sent and others I received?

The purpose is to display the conversation like in the picture.enter image description here

This is how I read messages sent between two users.

function readConversationWithUser(userId){
  return new Promise((resolve) => {
    var messageSession = api.readDbSession(userId.toString(), 0, null,
    function on_read(count) {
      var messages = messageSession.getMessages();
      resolve(messages);
    });

    messageSession.enableReadReceipt(true);
    messageSession.read(100);
  });
}

userId is my user's unique address.

Thank you very much for your help!

PS: Is there any library to use with angular application or typescript?

  • Hi, you can check the m.status or m.incoming() to know if the message is incoming or outgoing. m.status will give you additional info. – mesibo Apr 19 '22 at 04:03
  • Hi thank you for your answer, I checked what you told me and finally could resolve the issue with: msg.isIncoming() the status returns a number like 19, 1, 0... So it is not clear what this status means, and can not find anything about it in doc. – Anas Sabbani Apr 19 '22 at 12:58
  • Open api.js in an editor and search for MESIBO_MSGSTATUS_OUTBOX. You will find an entire list of status. Also refer to here https://mesibo.com/documentation/api/real-time-api/data-structures/ – mesibo Apr 20 '22 at 02:38

0 Answers0