Skip to content

MessagesResource

Defined in: src/resources/messages.ts:86

Outbound Messages API exposed as client.messages.

new MessagesResource(request, getDefaultPhoneNumberId): MessagesResource

Defined in: src/resources/messages.ts:90

RequestFn

PhoneNumberIdAccessor

MessagesResource

markAsRead(messageId, phoneNumberId?): Promise<SendMessageResponse>

Defined in: src/resources/messages.ts:508

Marks a received message as read.

string

string

Promise<SendMessageResponse>


sendAddressMessage(to, payload, options?): Promise<SendMessageResponse>

Defined in: src/resources/messages.ts:437

Sends an interactive address message (supported in India and Singapore), prompting the user to supply or confirm a delivery address.

The parameters object (country, pre-filled values, saved addresses, and validation errors) is serialized into the JSON-encoded action.parameters string the API requires. The submitted address arrives via webhook as an interactive nfm_reply.

MessageRecipient

AddressMessagePayload

SendOptions

Promise<SendMessageResponse>


sendAudio(to, audio, options?): Promise<SendMessageResponse>

Defined in: src/resources/messages.ts:136

Sends an audio message from an uploaded media id or a public link.

MessageRecipient

MediaSource

SendOptions

Promise<SendMessageResponse>


sendContacts(to, contacts, options?): Promise<SendMessageResponse>

Defined in: src/resources/messages.ts:186

Sends one or more contact cards.

MessageRecipient

Contact[]

SendOptions

Promise<SendMessageResponse>


sendDocument(to, document, options?): Promise<SendMessageResponse>

Defined in: src/resources/messages.ts:146

Sends a document message, with optional caption and display filename.

MessageRecipient

DocumentMedia

SendOptions

Promise<SendMessageResponse>


sendImage(to, image, options?): Promise<SendMessageResponse>

Defined in: src/resources/messages.ts:116

Sends an image message from an uploaded media id or a public link.

MessageRecipient

CaptionedMedia

SendOptions

Promise<SendMessageResponse>


sendInteractiveButtons(to, payload, options?): Promise<SendMessageResponse>

Defined in: src/resources/messages.ts:218

Sends an interactive message with up to three reply buttons.

Throws WhatsAppValidationError when more than three buttons are given.

MessageRecipient

InteractiveButtonsPayload

SendOptions

Promise<SendMessageResponse>


sendInteractiveCtaUrl(to, payload, options?): Promise<SendMessageResponse>

Defined in: src/resources/messages.ts:283

Sends an interactive call-to-action URL message, rendering a tappable button that opens the given URL.

MessageRecipient

CtaUrlPayload

SendOptions

Promise<SendMessageResponse>


sendInteractiveFlow(to, payload, options?): Promise<SendMessageResponse>

Defined in: src/resources/messages.ts:309

Sends an interactive flow message that opens a WhatsApp Flow.

MessageRecipient

FlowPayload

SendOptions

Promise<SendMessageResponse>


sendInteractiveList(to, payload, options?): Promise<SendMessageResponse>

Defined in: src/resources/messages.ts:246

Sends an interactive list message with grouped selectable rows.

MessageRecipient

InteractiveListPayload

SendOptions

Promise<SendMessageResponse>


sendLocation(to, location, options?): Promise<SendMessageResponse>

Defined in: src/resources/messages.ts:166

Sends a location message.

MessageRecipient

LocationPayload

SendOptions

Promise<SendMessageResponse>


sendLocationRequest(to, payload, options?): Promise<SendMessageResponse>

Defined in: src/resources/messages.ts:347

Sends an interactive location-request message prompting the user to share.

MessageRecipient

LocationRequestPayload

SendOptions

Promise<SendMessageResponse>


sendProduct(to, payload, options?): Promise<SendMessageResponse>

Defined in: src/resources/messages.ts:367

Sends a single-product interactive message from a catalog.

MessageRecipient

ProductPayload

SendOptions

Promise<SendMessageResponse>


sendProductList(to, payload, options?): Promise<SendMessageResponse>

Defined in: src/resources/messages.ts:398

Sends a multi-product interactive message from a catalog.

MessageRecipient

ProductListPayload

SendOptions

Promise<SendMessageResponse>


sendRaw<TResponse>(body, options?): Promise<TResponse>

Defined in: src/resources/messages.ts:558

Escape hatch: POSTs an arbitrary message body to {phoneNumberId}/messages.

Use it for message shapes or fields Meta has released that the typed senders do not cover yet. messaging_product: 'whatsapp' is added when the body does not set it. The body is sent as given: there is no client-side validation. Retries, timeouts and error mapping are the same as for the other senders. The result type is whatever you declare in TResponse.

TResponse = SendMessageResponse

Record<string, unknown>

SendRawOptions

Promise<TResponse>

await client.messages.sendRaw({
recipient: 'US.13491208655302741918',
type: 'text',
text: { body: 'Hello' },
});

sendReaction(to, reaction, options?): Promise<SendMessageResponse>

Defined in: src/resources/messages.ts:489

Reacts to a previously received message with an emoji.

Passing an empty emoji removes a previously applied reaction.

MessageRecipient

ReactionPayload

SendOptions

Promise<SendMessageResponse>


sendSticker(to, sticker, options?): Promise<SendMessageResponse>

Defined in: src/resources/messages.ts:156

Sends a sticker message from an uploaded media id or a public link.

MessageRecipient

MediaSource

SendOptions

Promise<SendMessageResponse>


sendTemplate(to, template, options?): Promise<SendMessageResponse>

Defined in: src/resources/messages.ts:195

Sends a pre-approved message template.

MessageRecipient

TemplatePayload

SendOptions

Promise<SendMessageResponse>


sendText(to, text, opts?, options?): Promise<SendMessageResponse>

Defined in: src/resources/messages.ts:96

Sends a text message, optionally enabling link previews.

MessageRecipient

string

TextMessageOptions

SendOptions

Promise<SendMessageResponse>


sendTypingIndicator(messageId, phoneNumberId?): Promise<SendMessageResponse>

Defined in: src/resources/messages.ts:528

Marks a received message as read and shows a typing indicator to the user.

The indicator is dismissed when you send a message or after about 25 seconds. messageId is the WAMID of the inbound message being replied to. Only the text indicator type is currently supported.

string

string

Promise<SendMessageResponse>


sendVideo(to, video, options?): Promise<SendMessageResponse>

Defined in: src/resources/messages.ts:126

Sends a video message from an uploaded media id or a public link.

MessageRecipient

CaptionedMedia

SendOptions

Promise<SendMessageResponse>

Independent open-source project. Not affiliated with, endorsed by or sponsored by Meta or WhatsApp. Released under the MIT licence. Source on GitHub.