Skip to main content

AnyMessageContent

Union type representing all possible message content types that can be sent.
type AnyMessageContent =
  | AnyRegularMessageContent
  | { forward: WAMessage; force?: boolean }
  | { delete: WAMessageKey }
  | { disappearingMessagesInChat: boolean | number }
  | { limitSharing: boolean }

AnyRegularMessageContent

Union type for standard message content types.
type AnyRegularMessageContent = (
  | TextMessageContent
  | AnyMediaMessageContent
  | { event: EventMessageOptions }
  | PollMessageContent
  | ContactsMessageContent
  | LocationMessageContent
  | { react: proto.Message.IReactionMessage }
  | ButtonReplyMessageContent
  | GroupInviteMessageContent
  | ListReplyMessageContent
  | PinMessageContent
  | ProductMessageContent
  | SharePhoneNumber
  | RequestPhoneNumber
) & ViewOnce

Text Messages

TextMessageContent

Send text messages with optional mentions, link previews, and context.
text
string
required
The text content of the message
Optional link preview information for URLs in the text
mentions
string[]
List of JIDs that are mentioned in the text (e.g., ['[email protected]'])
contextInfo
proto.IContextInfo
Additional context information (quoted messages, forwarding info, etc.)
edit
WAMessageKey
Message key of the message to edit (for editing existing messages)
Type Definition:
type TextMessageContent = {
  text: string
  linkPreview?: WAUrlInfo | null
} & Mentionable & Contextable & Editable

Media Messages

AnyMediaMessageContent

Union type for all media message types.
type AnyMediaMessageContent = (
  | ImageMessageContent
  | VideoMessageContent
  | AudioMessageContent
  | StickerMessageContent
  | DocumentMessageContent
) & { mimetype?: string } & Editable

ImageMessageContent

Send image messages with optional captions and dimensions.
image
WAMediaUpload
required
The image file as Buffer, stream, or URL
caption
string
Optional caption for the image
jpegThumbnail
string
JPEG thumbnail as base64 string
width
number
Image width in pixels
height
number
Image height in pixels
mentions
string[]
List of mentioned JIDs in the caption
contextInfo
proto.IContextInfo
Additional context information
mimetype
string
MIME type of the image (e.g., ‘image/jpeg’, ‘image/png’)
Type Definition:
type ImageMessageContent = {
  image: WAMediaUpload
  caption?: string
  jpegThumbnail?: string
} & Mentionable & Contextable & WithDimensions

VideoMessageContent

Send video messages with optional captions, GIF playback, and PTV support.
video
WAMediaUpload
required
The video file as Buffer, stream, or URL
caption
string
Optional caption for the video
gifPlayback
boolean
If true, plays the video as a looping GIF
jpegThumbnail
string
JPEG thumbnail as base64 string
ptv
boolean
If set to true, will send as a video note (round video message)
width
number
Video width in pixels
height
number
Video height in pixels
mentions
string[]
List of mentioned JIDs in the caption
contextInfo
proto.IContextInfo
Additional context information
mimetype
string
MIME type of the video (e.g., ‘video/mp4’)
Type Definition:
type VideoMessageContent = {
  video: WAMediaUpload
  caption?: string
  gifPlayback?: boolean
  jpegThumbnail?: string
  ptv?: boolean
} & Mentionable & Contextable & WithDimensions

AudioMessageContent

Send audio messages or voice notes.
audio
WAMediaUpload
required
The audio file as Buffer, stream, or URL
ptt
boolean
If set to true, will send as a voice note (push-to-talk)
seconds
number
Optional duration of the audio in seconds
mimetype
string
MIME type of the audio (e.g., ‘audio/ogg; codecs=opus’, ‘audio/mp4’)
Type Definition:
type AudioMessageContent = {
  audio: WAMediaUpload
  ptt?: boolean
  seconds?: number
}

StickerMessageContent

Send sticker messages with optional animation.
sticker
WAMediaUpload
required
The sticker file as Buffer, stream, or URL (WebP format)
isAnimated
boolean
If true, the sticker is animated
width
number
Sticker width in pixels
height
number
Sticker height in pixels
mimetype
string
MIME type (usually ‘image/webp’)
Type Definition:
type StickerMessageContent = {
  sticker: WAMediaUpload
  isAnimated?: boolean
} & WithDimensions

DocumentMessageContent

Send document files with specified MIME type.
document
WAMediaUpload
required
The document file as Buffer, stream, or URL
mimetype
string
required
MIME type of the document (e.g., ‘application/pdf’, ‘application/vnd.openxmlformats-officedocument.wordprocessingml.document’)
fileName
string
Optional filename to display
caption
string
Optional caption for the document
contextInfo
proto.IContextInfo
Additional context information
Type Definition:
type DocumentMessageContent = {
  document: WAMediaUpload
  mimetype: string
  fileName?: string
  caption?: string
} & Contextable

Interactive Messages

PollMessageContent

Create poll messages with multiple selectable options.
poll
PollMessageOptions
required
Poll configuration object
poll.name
string
required
The poll question
poll.values
string[]
required
Array of poll options
poll.selectableCount
number
Number of options users can select (default: 1)
poll.messageSecret
Uint8Array
32-byte message secret to encrypt poll selections
poll.toAnnouncementGroup
boolean
Whether the poll is sent to an announcement group
mentions
string[]
List of mentioned JIDs
contextInfo
proto.IContextInfo
Additional context information
Type Definition:
type PollMessageContent = {
  poll: PollMessageOptions
} & Mentionable & Contextable & Editable

type PollMessageOptions = {
  name: string
  selectableCount?: number
  values: string[]
  messageSecret?: Uint8Array
  toAnnouncementGroup?: boolean
}

EventMessageContent

Create event messages for scheduling meetings and calls.
event
EventMessageOptions
required
Event configuration object
event.name
string
required
Event name/title
event.startDate
Date
required
Event start date and time
event.description
string
Optional event description
event.endDate
Date
Optional event end date and time
event.location
WALocationMessage
Optional event location
event.call
'audio' | 'video'
Type of call associated with the event
event.isCancelled
boolean
Whether the event is cancelled
event.isScheduleCall
boolean
Whether this is a scheduled call
event.extraGuestsAllowed
boolean
Whether extra guests are allowed
event.messageSecret
Uint8Array
Message secret for encryption
Type Definition:
type EventMessageOptions = {
  name: string
  description?: string
  startDate: Date
  endDate?: Date
  location?: WALocationMessage
  call?: 'audio' | 'video'
  isCancelled?: boolean
  isScheduleCall?: boolean
  extraGuestsAllowed?: boolean
  messageSecret?: Uint8Array
}

ReactionMessage

React to messages with emojis.
react
proto.Message.IReactionMessage
required
Reaction message object
react.key
WAMessageKey
required
Key of the message to react to
react.text
string
required
Emoji to react with (empty string to remove reaction)
Type Definition:
type ReactionMessage = {
  react: proto.Message.IReactionMessage
}

Contact & Location Messages

ContactsMessageContent

Share contact information.
contacts
object
required
Contacts object containing display name and contact array
contacts.displayName
string
Optional display name for the contacts
contacts.contacts
proto.Message.IContactMessage[]
required
Array of contact messages
Type Definition:
type ContactsMessageContent = {
  contacts: {
    displayName?: string
    contacts: proto.Message.IContactMessage[]
  }
}

LocationMessageContent

Share location information.
location
WALocationMessage
required
Location message object
location.degreesLatitude
number
required
Latitude coordinate
location.degreesLongitude
number
required
Longitude coordinate
location.name
string
Optional location name
location.address
string
Optional location address
Type Definition:
type LocationMessageContent = {
  location: WALocationMessage
}

type WALocationMessage = proto.Message.ILocationMessage

Business Messages

ProductMessageContent

Send product catalog messages.
product
WASendableProduct
required
Product information object
businessOwnerJid
string
JID of the business owner
body
string
Optional message body text
Optional footer text
Type Definition:
type ProductMessageContent = {
  product: WASendableProduct
  businessOwnerJid?: string
  body?: string
  footer?: string
}

type WASendableProduct = Omit<proto.Message.ProductMessage.IProductSnapshot, 'productImage'> & {
  productImage: WAMediaUpload
}

Reply & Interaction Messages

ButtonReplyMessageContent

Reply to button messages.
buttonReply
ButtonReplyInfo
required
Button reply information
buttonReply.displayText
string
required
Display text of the button
buttonReply.id
string
required
Button ID
buttonReply.index
number
required
Button index
type
'template' | 'plain'
required
Type of button reply
Type Definition:
type ButtonReplyMessageContent = {
  buttonReply: ButtonReplyInfo
  type: 'template' | 'plain'
}

type ButtonReplyInfo = {
  displayText: string
  id: string
  index: number
}

ListReplyMessageContent

Reply to list messages.
listReply
Omit<proto.Message.IListResponseMessage, 'contextInfo'>
required
List reply message object (without contextInfo)
Type Definition:
type ListReplyMessageContent = {
  listReply: Omit<proto.Message.IListResponseMessage, 'contextInfo'>
}

GroupInviteMessageContent

Send group invitation messages.
groupInvite
GroupInviteInfo
required
Group invitation information
groupInvite.inviteCode
string
required
Group invite code
groupInvite.inviteExpiration
number
required
Invite expiration timestamp
groupInvite.text
string
required
Invitation text
groupInvite.jid
string
required
Group JID
groupInvite.subject
string
required
Group subject/name
Type Definition:
type GroupInviteMessageContent = {
  groupInvite: GroupInviteInfo
}

type GroupInviteInfo = {
  inviteCode: string
  inviteExpiration: number
  text: string
  jid: string
  subject: string
}

Message Actions

ForwardMessage

Forward existing messages.
forward
WAMessage
required
The message to forward
force
boolean
Force forwarding even if message is not forwardable
Type Definition:
type ForwardMessage = {
  forward: WAMessage
  force?: boolean
}

DeleteMessage

Delete messages (your own or anyone’s in a group if you’re an admin).
delete
WAMessageKey
required
Message key of the message to delete
Type Definition:
type DeleteMessage = {
  delete: WAMessageKey
}

PinMessage

Pin messages in a chat.
pin
WAMessageKey
required
Message key of the message to pin
type
proto.PinInChat.Type
required
Pin type (PIN_IN_CHAT or UNPIN_IN_CHAT)
time
86400 | 604800 | 2592000
Pin duration: 86400 (24 hours), 604800 (7 days), or 2592000 (30 days)
Type Definition:
type PinMessage = {
  pin: WAMessageKey
  type: proto.PinInChat.Type
  time?: 86400 | 604800 | 2592000
}

DisappearingMessagesToggle

Toggle disappearing messages in a chat.
disappearingMessagesInChat
boolean | number
required
false to disable, or a number (in seconds) to enable with expiration time
Type Definition:
type DisappearingMessagesToggle = {
  disappearingMessagesInChat: boolean | number
}

LimitSharingToggle

Limit message forwarding and sharing.
limitSharing
boolean
required
Whether to limit sharing of messages
Type Definition:
type LimitSharingToggle = {
  limitSharing: boolean
}

Privacy & Sharing

SharePhoneNumber

Share your phone number.
sharePhoneNumber
boolean
required
Whether to share phone number
Type Definition:
type SharePhoneNumber = {
  sharePhoneNumber: boolean
}

RequestPhoneNumber

Request phone number from recipient.
requestPhoneNumber
boolean
required
Whether to request phone number
Type Definition:
type RequestPhoneNumber = {
  requestPhoneNumber: boolean
}

Helper Types

ViewOnce

Make any message viewable only once.
viewOnce
boolean
If true, the message will be viewable only once
Type Definition:
type ViewOnce = {
  viewOnce?: boolean
}

Mentionable

Add mentions to messages. Type Definition:
type Mentionable = {
  mentions?: string[]
}

Contextable

Add context information to messages. Type Definition:
type Contextable = {
  contextInfo?: proto.IContextInfo
}

Editable

Mark messages as edits of existing messages. Type Definition:
type Editable = {
  edit?: WAMessageKey
}

WithDimensions

Specify media dimensions. Type Definition:
type WithDimensions = {
  width?: number
  height?: number
}

Build docs developers (and LLMs) love