Skip to main content
Baileys provides comprehensive TypeScript types for working with WhatsApp messages.

Core Message Types

WAMessage

Extends proto.IWebMessageInfo with additional Baileys-specific fields.
WAMessageKey
required
Unique identifier for the message
WAMessageContent
The actual message content (proto.IMessage)
number | Long
Unix timestamp when message was sent
any
Parameters for stub messages (system messages)
string
Message category classification
number
Number of times message delivery has been retried

WAMessageKey

Extends proto.IMessageKey with additional routing information.
string
JID of the chat (group or individual)
boolean
Whether the message was sent by you
string
Unique message ID
string
Sender’s JID in group chats
string
Alternative JID format (Baileys extension)
string
Alternative participant format (Baileys extension)
string
Server-assigned ID (Baileys extension)
string
Addressing mode: ‘pn’ or ‘lid’ (Baileys extension)
boolean
Whether this is a view-once message (Baileys extension)

Message Content Types

AnyMessageContent

Union type for all possible message content:

AnyRegularMessageContent

Union of all regular message types you can send:
string
required
The message text
Link preview metadata
string[]
Array of mentioned JIDs
proto.IContextInfo
Context info (quoted message, etc.)
WAMessageKey
Key of message to edit

AnyMediaMessageContent

Union type for all media message types:

WAMediaUpload

Union type for media upload sources:

Special Message Types

PollMessageOptions

string
required
Poll question
string[]
required
Array of poll options
number
Number of options users can select (default: 1)
Uint8Array
32-byte secret to encrypt poll selections
boolean
Whether poll is for announcement group

EventMessageOptions

string
required
Event title
Date
required
Event start date/time
string
Event description
Date
Event end date/time
WALocationMessage
Event location
'audio' | 'video'
Type of call event
boolean
Whether event is cancelled
boolean
Whether this is a scheduled call
boolean
Whether guests can bring +1

Message Generation Options

MessageGenerationOptions

Date
Manual message timestamp
WAMessage
Message to quote/reply to
number | string
Disappearing message timer
string
Custom message ID override
number
Timeout for media uploads
string[]
JID list for status broadcasts
string
Background color for status
number
Font type for status

Message Updates and Events

MessageUpsertType

  • notify: New message that should trigger a notification
  • append: Historical message being synced, no notification needed

WAMessageUpdate

WAMessageKey
required
Key identifying the message to update
Partial<WAMessage>
required
Partial message data with updates to apply

MessageUserReceipt

Alias for proto.IUserReceipt containing:
string
User who sent the receipt
number | Long
When the receipt was sent
number | Long
When the message was read
number | Long
When media was played

Utility Types

DownloadableMessage

Messages that contain downloadable media:
Uint8Array | null
Encryption key for media
string | null
Direct download path
string | null
Download URL

MessageReceiptType

MinimalMessage

Minimal message data for references:

Example Usage