Skip to content

Message identifier in chat#

Beta version

The functionality is in beta. Features may change and may also work unstably.

The message identifier (idMessage) is a marker that the system assigns to every message. It is assigned to incoming and outgoing messages and allows you to find a specific message in a chat.

Example: 32992354783594572492903878028689408.

Important

You are NOT required to generate the message identifier manually. It is assigned by the system and returned by the GREEN-API methods.

Uniqueness of the identifier#

The identifier is unique within an account: one and the same message has the same idMessage in all chats and in all clients of the account. The identifier does not change over time and is kept after an instance reboot.

If the account is connected to several instances, one and the same message arrives at each instance with the same idMessage. The unique key within your system is the combination of idInstance + idMessage:

5100000000_32992354783594572492903878028689408

The identifier of a reaction

A reaction is not a separate message in Instagram - it is a mark on a message. Its idMessage is a number of the same kind as a message identifier, but it differs from the identifier of the message the reaction is set on: the system composes it from the identifier of the message and of the reaction author. The SendReaction method returns the identifier of the reaction itself. The message the reaction refers to arrives in the quotedMessage object.

How to get the identifier#

The identifier can be obtained when sending, through the journal methods or in an incoming notification in the idMessage field. Example of a response from the SendMessage method:

{
    "idMessage": "32992354783594572492903878028689408"
}

How to use the identifier#

The message identifier is used to find a specific message in a chat:

  • get a message from the journal - by the GetMessage method, using the chatId and idMessage pair;
  • reply to a message - by the quotedMessageId field in the sending methods;
  • forward a message to another chat - by the ForwardMessages method;
  • edit the text of a message - by the EditMessage method;
  • delete a message - by the DeleteMessage method;
  • set or remove a reaction - by the SendReaction method;
  • get a link to an attachment - by the DownloadFile method.