Skip to main content

Core message types

WAMessage

Represents a complete WhatsApp message with metadata.
export type WAMessage = proto.IWebMessageInfo & {
  key: WAMessageKey
  messageStubParameters?: any
  category?: string
  retryCount?: number
}
key
WAMessageKey
required
Unique identifier for the message
message
WAMessageContent
The actual message content (text, media, etc.)
messageTimestamp
number
Unix timestamp when the message was sent
messageStubParameters
any[]
Parameters for system messages (group events, etc.)
category
string
Message category classification
retryCount
number
Number of times message delivery was retried

WAMessageKey

Unique identifier for a message across conversations.
export type WAMessageKey = proto.IMessageKey & {
  remoteJidAlt?: string
  participantAlt?: string
  server_id?: string
  addressingMode?: string
  isViewOnce?: boolean
}
remoteJid
string
required
JID of the chat (user or group)
fromMe
boolean
required
Whether the message was sent by you
id
string
required
Unique message ID
participant
string
JID of sender in group chats

WAMessageContent

The Protocol Buffer message content.
export type WAMessageContent = proto.IMessage
This type includes all possible message content types from the WhatsApp protocol.

Message content types

AnyMessageContent

Union type for all sendable message content.
export type AnyMessageContent =
  | AnyRegularMessageContent
  | { forward: WAMessage; force?: boolean }
  | { delete: WAMessageKey }
  | { disappearingMessagesInChat: boolean | number }
  | { limitSharing: boolean }

AnyRegularMessageContent

Regular user-sent messages.
export type AnyRegularMessageContent = (
  | TextMessageContent
  | AnyMediaMessageContent
  | { event: EventMessageOptions }
  | { poll: PollMessageOptions }
  | { contacts: ContactsContent }
  | { location: WALocationMessage }
  | { react: proto.Message.IReactionMessage }
  | ButtonReplyContent
  | GroupInviteContent
  | ListReplyContent
  | PinMessageContent
  | ProductMessageContent
  | SharePhoneNumber
  | RequestPhoneNumber
) & ViewOnce

Text messages

type TextMessageContent = {
  text: string
  linkPreview?: WAUrlInfo | null
} & Mentionable & Contextable & Editable
text
string
required
The message text content
Link preview metadata
mentions
string[]
JIDs of users mentioned in the text
contextInfo
proto.IContextInfo
Context information (quoted message, etc.)
edit
WAMessageKey
Key of message being edited

AnyMediaMessageContent

Media messages (images, videos, audio, documents, stickers).
export type AnyMediaMessageContent = (
  | ImageMessage
  | VideoMessage
  | AudioMessage
  | StickerMessage
  | DocumentMessage
) & { mimetype?: string } & Editable

Image message

type ImageMessage = {
  image: WAMediaUpload
  caption?: string
  jpegThumbnail?: string
  width?: number
  height?: number
} & Mentionable & Contextable
image
WAMediaUpload
required
Image file (Buffer, stream, or URL)
caption
string
Image caption text
jpegThumbnail
string
Base64 JPEG thumbnail
width
number
Image width in pixels
height
number
Image height in pixels

Video message

type VideoMessage = {
  video: WAMediaUpload
  caption?: string
  gifPlayback?: boolean
  jpegThumbnail?: string
  ptv?: boolean
  width?: number
  height?: number
} & Mentionable & Contextable
video
WAMediaUpload
required
Video file (Buffer, stream, or URL)
caption
string
Video caption text
gifPlayback
boolean
Play as GIF (no sound)
ptv
boolean
Send as video note (round video)

Audio message

type AudioMessage = {
  audio: WAMediaUpload
  ptt?: boolean
  seconds?: number
}
audio
WAMediaUpload
required
Audio file (Buffer, stream, or URL)
ptt
boolean
Send as voice note
seconds
number
Audio duration in seconds

Sticker message

type StickerMessage = {
  sticker: WAMediaUpload
  isAnimated?: boolean
  width?: number
  height?: number
}
sticker
WAMediaUpload
required
Sticker file (Buffer, stream, or URL)
isAnimated
boolean
Whether sticker is animated

Document message

type DocumentMessage = {
  document: WAMediaUpload
  mimetype: string
  fileName?: string
  caption?: string
} & Contextable
document
WAMediaUpload
required
Document file (Buffer, stream, or URL)
mimetype
string
required
MIME type of the document
fileName
string
Display name for the file

WAMediaUpload

Type for uploading media files.
export type WAMediaUpload = 
  | Buffer 
  | WAMediaPayloadStream 
  | WAMediaPayloadURL

export type WAMediaPayloadURL = { url: URL | string }
export type WAMediaPayloadStream = { stream: Readable }

Special message types

Poll message

export type PollMessageOptions = {
  name: string
  selectableCount?: number
  values: string[]
  messageSecret?: Uint8Array
  toAnnouncementGroup?: boolean
}
name
string
required
Poll question
values
string[]
required
Array of poll options
selectableCount
number
Number of options users can select (default: 1)
messageSecret
Uint8Array
32-byte secret to encrypt poll selections

Event message

export type EventMessageOptions = {
  name: string
  description?: string
  startDate: Date
  endDate?: Date
  location?: WALocationMessage
  call?: 'audio' | 'video'
  isCancelled?: boolean
  isScheduleCall?: boolean
  extraGuestsAllowed?: boolean
  messageSecret?: Uint8Array
}
name
string
required
Event title
startDate
Date
required
Event start time
description
string
Event description
endDate
Date
Event end time
call
'audio' | 'video'
Type of call event

Message metadata types

MessageUpsertType

Indicates how a message should be handled.
export type MessageUpsertType = 'append' | 'notify'
  • notify: New message requiring user notification
  • append: Add to history without notification

WAMessageUpdate

Partial update to an existing message.
export type WAMessageUpdate = { 
  update: Partial<WAMessage>
  key: WAMessageKey 
}

MessageReceiptType

Types of message receipts.
export type MessageReceiptType =
  | 'read'
  | 'read-self'
  | 'hist_sync'
  | 'peer_msg'
  | 'sender'
  | 'inactive'
  | 'played'
  | undefined

MessageUserReceiptUpdate

User-level read receipt update.
export type MessageUserReceiptUpdate = { 
  key: WAMessageKey
  receipt: MessageUserReceipt 
}

export type MessageUserReceipt = proto.IUserReceipt

Message generation options

MiscMessageGenerationOptions

Options for generating messages.
export type MiscMessageGenerationOptions = {
  messageId?: string
  timestamp?: Date
  quoted?: WAMessage
  ephemeralExpiration?: number | string
  mediaUploadTimeoutMs?: number
  statusJidList?: string[]
  backgroundColor?: string
  font?: number
  broadcast?: boolean
  useCachedGroupMetadata?: boolean
}
messageId
string
Custom message ID (auto-generated if not provided)
timestamp
Date
Custom message timestamp
quoted
WAMessage
Message to quote/reply to
ephemeralExpiration
number | string
Disappearing message duration
mediaUploadTimeoutMs
number
Timeout for media uploads
statusJidList
string[]
JIDs for status@broadcast messages

MessageRelayOptions

Options for relaying messages.
export type MessageRelayOptions = {
  messageId?: string
  participant?: { jid: string; count: number }
  additionalAttributes?: { [_: string]: string }
  additionalNodes?: BinaryNode[]
  useUserDevicesCache?: boolean
  useCachedGroupMetadata?: boolean
  statusJidList?: string[]
}
participant
{ jid: string; count: number }
Send to specific participant (for retries)
additionalAttributes
object
Extra attributes for WA binary node
useUserDevicesCache
boolean
default:true
Use cached device list
useCachedGroupMetadata
boolean
default:true
Use cached group metadata

Build docs developers (and LLMs) love