Receiving Group Messages

Group messages arrive through a dedicated callback, separate from 1:1 messages:

client.onGroupMessage((msg) => {
  console.log(`[${msg.groupId}] ${msg.senderId}: ${msg.plaintext}`);
});

// Remove listener
client.offGroupMessage(handler);

Message fields

  • groupId, the group the message belongs to
  • messageId, unique message identifier
  • senderId, the user who sent the message
  • plaintext / text, decrypted message content
  • metadata, optional JSON metadata
  • timestamp, server-assigned timestamp