Mesibo Real-time Chat APIs - Forward Messages

In this section, we will describe how to forward existing messages and check if any incoming message was forwarded.

Forward a Message

To forward an existing message, you only need to create a MesiboMessage object from the original message and send it.

MesiboMessage msg = origMessage.forward(profile);
msg.send();

where the profile is the user or group profile to whom you want to forward the message. You can change the properties of the new message like expiry, message ID, type, etc. However, you can not modify the message content.

Forwarding Multiple Messages

To forward multiple messages to a user or a group, you need to create a new MesiboMessage object and initialize it with message-IDs of all messages to be forwarded, and send, as shown below.

MesiboMessage msg = profile.newMessage();
msg.setForwarded(origMessageIds);
msg.send();

Where

ParameterDescription
profileuser or group profile to whom you want to forward the message
origMessageIdsArray containing message-IDs of the messages to be forwarded

Checking if the message was Forwarded

The recipient can check if the message was forwarded by calling isForwarded function

msg.isForwrded();

The isForwarded function returns true if the message was forwarded, false otherwise.

Marking message as forwarded

By default, mesibo marks the message as forwarded if forwarding APIs were used when sending. However, you can disable this behavior by setting markAsForwarded property of the MesiboMessage object. In that case, the message will be sent as a normal message and isForwarded function on the recipient side will return false.

msg.markForwarded  = false;