Irish.MessageKey (irish v1.1.0)

Copy Markdown View Source

Struct representing a WhatsApp message key.

Uniquely identifies a message in a chat. Used in receipts, reactions, replies, and deletion.

Fields

FieldTypeDescription
remote_jidString.t()Chat JID (user or group)
from_meboolean()Whether the message was sent by you
idString.t()Message ID
participantString.t()Sender JID in group messages

Examples

key = Irish.MessageKey.from_raw(%{
  "remoteJid" => "15551234567@s.whatsapp.net",
  "fromMe" => false,
  "id" => "ABCDEF123456"
})

key.remote_jid  #=> "15551234567@s.whatsapp.net"

# Convert back for the bridge
Irish.MessageKey.to_raw(key)
#=> %{"remoteJid" => "15551234567@s.whatsapp.net", "fromMe" => false, "id" => "ABCDEF123456"}

Summary

Functions

Build a MessageKey from a raw Baileys key map.

Convert back to a camelCase map for sending to the bridge.

Types

t()

@type t() :: %Irish.MessageKey{
  from_me: boolean(),
  id: String.t() | nil,
  participant: String.t() | nil,
  remote_jid: String.t() | nil
}

Functions

from_raw(data)

@spec from_raw(map()) :: t()

Build a MessageKey from a raw Baileys key map.

to_raw(key)

@spec to_raw(t()) :: map()

Convert back to a camelCase map for sending to the bridge.