kotlinmesibo

How to get mesibo message reply name


I tried to revamp mesibo reply message and have problem when getting the person name, this is the code I use enter image description here I use repliedToMessage to get reply information, but give wrong person name, for example I reply my message but the profile name I got from repliedToMessage return opposite person name enter image description here

How to determine the reply person name, it's reply from own or opposite message?

Update : i change the code to mesibo suggested answer enter image description here

it works for personal profile message, but still have a problem in group message

enter image description here

in group profile reply name still show self profile name


Solution

  • The profile is always for the peer. To display the proper name, you need to check if the replied message is incoming or outgoing.

    You can call isIncoming() or isOutgoing() on the MesiboMessage object returned by repliedToMessage() to determine the direction.

    For example:

    MesiboMessage rm = msg.getRepliedToMessage();
    
    if(rm.isIncoming()) {
    
        // display name from the profile
    
    } else if(rm.isOutgoing()) {
    
        // display name from self profile
    }
    

    Please refer to the example in the following documentation:

    https://docs.mesibo.com/tutorials/get-started/sending-and-receiving-messages/#receiving-messages-message-status-and-updates