Add participants to group
Optionalconfig: RequestConfigCheck if a number is registered on WhatsApp
Verifies whether a phone number is registered on WhatsApp. This is essential for avoiding spam flags when sending messages to new contacts. Use this before sending messages to unknown numbers, or use the safe send methods which call this automatically.
Phone number to check (with or without country code)
Optionalconfig: RequestConfigOptional request configuration to override defaults
Object with exists or numberExists boolean indicating if the number is on WhatsApp
// Check if a number exists on WhatsApp
const status = await client.checkNumberStatus('1234567890');
if (status.exists || status.numberExists) {
console.log('Number is registered on WhatsApp');
await client.sendText({
chatId: '1234567890@c.us',
text: 'Hello!',
});
} else {
console.log('Number is NOT on WhatsApp');
}
// Or use safe send methods which check automatically
const result = await client.safeSendText({
chatId: '1234567890@c.us',
text: 'Hello!',
});
if (result === null) {
console.log('Number not found - message not sent');
}
Convert audio to voice message format
Optionalconfig: RequestConfigCreate app
Create group
Creates a new WhatsApp group with the specified name and participants.
Group data including name and participants array
Optionalconfig: RequestConfigOptional request configuration to override defaults
Created group information
Create a new session
Creates a new WhatsApp session with the specified configuration. The session can be started immediately or configured for later use.
Session configuration data including name and optional settings
Optionalconfig: RequestConfigOptional request configuration to override defaults
Created session information
Delete all messages from chat
Optionalconfig: RequestConfigDelete app
Delete message
Optionalconfig: RequestConfigDelete a session
Permanently deletes a session and all its data. This action cannot be undone.
Optionalconfig: RequestConfigOptional request configuration to override defaults (including session name)
API response confirming deletion
Demote participant from admin
Optionalconfig: RequestConfigEdit message
Optionalconfig: RequestConfigGet all contacts
Optionalparams: { limit?: number; offset?: number; sortBy?: string; sortOrder?: string }Optionalconfig: RequestConfigGet app by ID
Get all apps
Get browser trace
Get chats
Retrieves all chats (conversations) for the session, including individual chats and groups.
Optionalconfig: RequestConfigOptional request configuration to override defaults
Array of chat information objects
Get Chatwoot locales
Get contact profile picture
Optionalrefresh: booleanOptionalconfig: RequestConfigGet group info admin only setting
Optionalconfig: RequestConfigGet group messages admin only setting
Optionalconfig: RequestConfigGet all groups
Retrieves all groups that the authenticated account is a member of.
Optionalconfig: RequestConfigOptional request configuration to override defaults
Array of group information objects
Get heap snapshot
Get LID by phone number
Optionalconfig: RequestConfigGet specific message
Optionalconfig: RequestConfigGet messages from a chat
Retrieves message history from a specific chat conversation.
Chat ID in format: phone@c.us (individual) or groupId@g.us (group)
Optionalconfig: RequestConfigOptional request configuration to override defaults
Array of message information objects
// Get messages from a chat
const messages = await client.getMessages('1234567890@c.us');
console.log(`Found ${messages.length} messages`);
messages.forEach(msg => {
console.log(`${msg.from}: ${msg.body}`);
});
// Get messages from a group
const groupMessages = await client.getMessages('groupId@g.us');
Get messages
OptionalchatId: stringOptionallimit: numberOptionaldownloadMedia: booleanOptionalconfig: RequestConfigGet QR code for pairing WhatsApp API
Retrieves the QR code that can be scanned with WhatsApp mobile app to authenticate the session.
Format of the QR code: 'image' returns a PNG image, 'raw' returns the raw QR code data
Optionalconfig: RequestConfigOptional request configuration to override defaults
QR code in the specified format
Get server environment
Get server status
Get server version
Get session information
Retrieves detailed information about a specific session including its status, configuration, and WhatsApp account details.
Optionalconfig: RequestConfigOptional request configuration to override defaults (including session name)
Session information including name, status, config, and me object
Get session "me" info
Retrieves information about the authenticated WhatsApp account for this session, including phone number, profile name, and other account details.
Optionalconfig: RequestConfigOptional request configuration to override defaults (including session name)
Account information for the authenticated session
Get all sessions
Lists all WhatsApp sessions configured on the WAHA server, including their current status.
Optionalconfig: RequestConfigOptional request configuration to override defaults
Array of session information objects
Get API version
Health check
Logout from a session (bulk operation)
Optionalconfig: RequestConfigPing endpoint
Pin message
Optionaldata: anyOptionalconfig: RequestConfigPromote participant to admin
Optionalconfig: RequestConfigReact to a message
Optionalconfig: RequestConfigMark chat messages as read
Optionaldata: anyOptionalconfig: RequestConfigRemove participants from group
Optionalconfig: RequestConfigRequest authentication code
Requests an authentication code to be sent via SMS or voice call for phone number-based authentication.
Object containing phoneNumber and optional method ('sms' or 'voice')
Optionalconfig: RequestConfigOptional request configuration to override defaults
Response indicating the code was sent
Safely send buttons with anti-blocking measures
This method implements WhatsApp's recommended anti-blocking guidelines by checking if the number exists and using typing indicators before sending.
Message data including chatId, text, and buttons
Optionalconfig: RequestConfigOptional request configuration
API response with message info, or null if number doesn't exist on WhatsApp
Safely send a contact vCard with anti-blocking measures
This method implements WhatsApp's recommended anti-blocking guidelines by checking if the number exists and using typing indicators before sending.
Message data including chatId and contact information
Optionalconfig: RequestConfigOptional request configuration
API response with message info, or null if number doesn't exist on WhatsApp
Safely send a file message with anti-blocking measures
This method implements WhatsApp's recommended anti-blocking guidelines:
Message parameters including chatId, file, optional filename and caption
API response with message info, or null if number doesn't exist on WhatsApp
Safely send an image message with anti-blocking measures
This method implements WhatsApp's recommended anti-blocking guidelines:
Message parameters including chatId, file, and optional caption
API response with message info, or null if number doesn't exist on WhatsApp
Safely send a link preview with anti-blocking measures
This method implements WhatsApp's recommended anti-blocking guidelines by checking if the number exists and using typing indicators before sending.
Message data including chatId and URL
Optionalconfig: RequestConfigOptional request configuration
API response with message info, or null if number doesn't exist on WhatsApp
Safely send a list message with anti-blocking measures
This method implements WhatsApp's recommended anti-blocking guidelines by checking if the number exists and using typing indicators before sending.
Message data including chatId, title, and list sections
Optionalconfig: RequestConfigOptional request configuration
API response with message info, or null if number doesn't exist on WhatsApp
Safely send a location message with anti-blocking measures
This method implements WhatsApp's recommended anti-blocking guidelines by checking if the number exists and using typing indicators before sending.
Message data including chatId, latitude, and longitude
Optionalconfig: RequestConfigOptional request configuration
API response with message info, or null if number doesn't exist on WhatsApp
Safely send a poll with anti-blocking measures
This method implements WhatsApp's recommended anti-blocking guidelines by checking if the number exists and using typing indicators before sending.
Message data including chatId, poll name, and options
Optionalconfig: RequestConfigOptional request configuration
API response with message info, or null if number doesn't exist on WhatsApp
Safely send a text message with anti-blocking measures
This method implements WhatsApp's recommended anti-blocking guidelines:
Following these steps helps avoid being flagged as spam by WhatsApp.
Message parameters including chatId and text
API response with message info, or null if number doesn't exist on WhatsApp
Safely send a video message with anti-blocking measures
This method implements WhatsApp's recommended anti-blocking guidelines by checking if the number exists and using typing indicators before sending.
Message data including chatId and video file
Optionalconfig: RequestConfigOptional request configuration
API response with message info, or null if number doesn't exist on WhatsApp
Safely send a voice message with anti-blocking measures
This method implements WhatsApp's recommended anti-blocking guidelines:
Message data including chatId and voice file
Optionalconfig: RequestConfigOptional request configuration
API response with message info, or null if number doesn't exist on WhatsApp
Send a file message
Sends a file/document to a chat. The file can be provided as a URL or base64-encoded data.
For better anti-spam protection, consider using safeSendFile() instead.
Message parameters including chatId, file, and optional filename/caption
File message parameters
Parameters for sending a file/document using sendFile() or safeSendFile().
Optionalcaption?: stringCaption for the file (optional) Text that will be displayed with the file
Chat ID to send message to Format: phone@c.us for individual chats, groupId@g.us for groups
Optionalconfig?: RequestConfigOptional request configuration override Allows overriding session, timeout, retry settings for this specific request
File data (base64 or URL) Can be a URL (http/https) or base64-encoded file data with data URI scheme
Optionalfilename?: stringFilename (optional) The name that will be shown for the file in WhatsApp
Optionalreply_to?: stringMessage ID to reply to (optional) If provided, the file will be sent as a reply to the specified message
API response with message information
// Send PDF file from URL
const response = await client.sendFile({
chatId: '1234567890@c.us',
file: 'https://example.com/document.pdf',
filename: 'report.pdf',
caption: 'Monthly report',
});
// Send file from base64
const base64Response = await client.sendFile({
chatId: '1234567890@c.us',
file: 'data:application/pdf;base64,JVBERi0xLjcKC...',
filename: 'document.pdf',
});
Send file (alternative endpoint)
Optionalconfig: RequestConfigSend an image message
Sends an image to a chat. The image can be provided as a URL or base64-encoded data.
For better anti-spam protection, consider using safeSendImage() instead.
Message parameters including chatId, file, and optional caption
Image message parameters
Parameters for sending an image message using sendImage() or safeSendImage().
Optionalcaption?: stringCaption for the image (optional) Text that will be displayed with the image
Chat ID to send message to Format: phone@c.us for individual chats, groupId@g.us for groups
Optionalconfig?: RequestConfigOptional request configuration override Allows overriding session, timeout, retry settings for this specific request
Image file data (base64 or URL) Can be a URL (http/https) or base64-encoded image data with data URI scheme
Optionalreply_to?: stringMessage ID to reply to (optional) If provided, the image will be sent as a reply to the specified message
API response with message information
// Send image from URL
const response = await client.sendImage({
chatId: '1234567890@c.us',
file: 'https://example.com/image.jpg',
caption: 'Check out this image!',
});
// Send image from base64
const base64Response = await client.sendImage({
chatId: '1234567890@c.us',
file: 'data:image/jpeg;base64,/9j/4AAQSkZJRg...',
caption: 'Image from base64',
});
Send image (alternative endpoint)
Optionalconfig: RequestConfigMark message as seen
Sends a "seen" receipt for a message or chat. This helps your bot appear more human-like and is recommended by WhatsApp's anti-blocking guidelines. The safe send methods call this automatically.
Object containing chatId and optional messageId
Chat ID in format: phone@c.us (individual) or groupId@g.us (group)
OptionalmessageId?: stringOptional specific message ID to mark as seen
Optionalconfig: RequestConfigOptional request configuration to override defaults
API response
Send a text message
Sends a plain text message to a chat. For better anti-spam protection, consider using safeSendText() instead.
Message parameters including chatId, text, and optional reply_to
Text message parameters
Parameters for sending a text message using sendText() or safeSendText().
Chat ID to send message to Format: phone@c.us for individual chats, groupId@g.us for groups
Optionalconfig?: RequestConfigOptional request configuration override Allows overriding session, timeout, retry settings for this specific request
Optionalreply_to?: stringMessage ID to reply to (optional) If provided, the message will be sent as a reply to the specified message
Text content of the message Plain text or text with WhatsApp formatting (e.g., bold, italic, ~strikethrough~)
API response with message information
Send text message (alternative endpoint)
Optionalconfig: RequestConfigSend text message via GET (alternative endpoint)
Optionalconfig: RequestConfigSet group description
Optionalconfig: RequestConfigSet group info admin only
Optionalconfig: RequestConfigSet group messages admin only
Optionalconfig: RequestConfigSet profile picture
Optionalconfig: RequestConfigSet profile status (About)
Optionalconfig: RequestConfigStar/unstar a message
Optionalconfig: RequestConfigStart a session
Starts a WhatsApp session. The session will begin the authentication process (QR code or pairing code).
Optionalconfig: RequestConfigOptional request configuration to override defaults (including session name)
Session information with updated status
Start a session (alternative endpoint)
Optionalconfig: RequestConfigStart typing indicator
Shows the "typing..." indicator in a chat. This helps your bot appear more human-like and is recommended by WhatsApp's anti-blocking guidelines. Remember to call stopTyping() after a realistic delay. The safe send methods handle this automatically.
Object containing chatId
Chat ID in format: phone@c.us (individual) or groupId@g.us (group)
Optionalconfig: RequestConfigOptional request configuration to override defaults
API response
// Show typing indicator
await client.startTyping({ chatId: '1234567890@c.us' });
// Wait for realistic typing time
await new Promise(resolve => setTimeout(resolve, 2000));
// Stop typing and send message
await client.stopTyping({ chatId: '1234567890@c.us' });
await client.sendText({
chatId: '1234567890@c.us',
text: 'Hello!',
});
Stop server
Stop a session
Stops a running WhatsApp session. This will disconnect the session but preserve its data for future use.
Optionalconfig: RequestConfigOptional request configuration to override defaults (including session name)
API response confirming the session was stopped
Stop typing indicator
Stops the "typing..." indicator in a chat. Should be called after startTyping() and before sending the actual message. The safe send methods handle this automatically.
Object containing chatId
Chat ID in format: phone@c.us (individual) or groupId@g.us (group)
Optionalconfig: RequestConfigOptional request configuration to override defaults
API response
// Start typing
await client.startTyping({ chatId: '1234567890@c.us' });
// Wait for realistic typing time
await new Promise(resolve => setTimeout(resolve, 2000));
// Stop typing
await client.stopTyping({ chatId: '1234567890@c.us' });
// Send the message
await client.sendText({
chatId: '1234567890@c.us',
text: 'Hello!',
});
Take screenshot
Optionalsession: stringUnpin message
Optionalconfig: RequestConfigUpdate app
Update session configuration
Updates the configuration of an existing session. The session must be stopped before updating.
Updated session configuration data
Optionalconfig: RequestConfigOptional request configuration to override defaults (including session name)
Updated session information
WAHA API Client Provides methods to interact with the WAHA WhatsApp API