waha-api-client-ts
    Preparing search index...

    Class WAHAClient

    WAHA API Client Provides methods to interact with the WAHA WhatsApp API

    Index

    Constructors

    Methods

    addGroupParticipants archiveChat blockContact checkContactExists checkNumberStatus convertToVoice convertVideo createApp createChannel createChatsOverview createGroup createLabel createSession deleteAllMessages deleteApp deleteChannel deleteChat deleteGroup deleteGroupPicture deleteLabel deleteMessage deleteProfilePicture deleteSession deleteStatus demoteGroupParticipant editMessage followChannel forwardMessage getAllContacts getAllPresence getApp getApps getBrowserTrace getChannel getChannelMessagesPreview getChannels getChannelSearchCategories getChannelSearchCountries getChannelSearchViews getChatLabels getChatPicture getChats getChatsByLabel getChatsOverview getChatwootLocales getContact getContactAbout getContactProfilePicture getGroup getGroupInfoAdminOnly getGroupInviteCode getGroupJoinInfo getGroupMessagesAdminOnly getGroupParticipants getGroupPicture getGroups getGroupsCount getHeapSnapshot getLabels getLid getLidByPhone getLids getLidsCount getMessage getMessages getMessagesAlt getNewMessageId getPresence getProfile getQR getServerEnvironment getServerStatus getServerVersion getSession getSessionMe getSessions getVersion health joinGroup leaveGroup logoutSession logoutSessionBulk markChatUnread muteChannel ping pinMessage postImageStatus postTextStatus postVideoStatus postVoiceStatus promoteGroupParticipant reaction readMessages refreshGroups removeGroupParticipants reply replyButton requestCode restartSession revokeGroupInviteCode safeSendButtons safeSendContactVcard safeSendFile safeSendImage safeSendLinkPreview safeSendList safeSendLocation safeSendPoll safeSendText safeSendVideo safeSendVoice searchChannelsByText searchChannelsByView sendButtons sendContactVcard sendEvent sendFile sendFileAlt sendImage sendImageAlt sendLinkCustomPreview sendLinkPreview sendList sendLocation sendPoll sendPollVote sendSeen sendText sendTextAlt sendTextGet sendVideo sendVoice setChatLabels setGroupDescription setGroupInfoAdminOnly setGroupMessagesAdminOnly setGroupPicture setGroupSubject setPresence setProfileName setProfilePicture setProfileStatus star startSession startSessionAlt startTyping stopServer stopSession stopSessionAlt stopTyping subscribePresence takeScreenshot unarchiveChat unblockContact unfollowChannel unmuteChannel unpinMessage updateApp updateContact updateLabel updateSession

    Constructors

    Methods

    • Add participants to group

      Parameters

      Returns Promise<any>

    • Check 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.

      Parameters

      • phone: string

        Phone number to check (with or without country code)

      • Optionalconfig: RequestConfig

        Optional request configuration to override defaults

      Returns Promise<{ exists: boolean; numberExists?: boolean }>

      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');
      }
    • Create app

      Parameters

      • data: any

      Returns Promise<any>

    • Create group

      Creates a new WhatsApp group with the specified name and participants.

      Parameters

      • data: any

        Group data including name and participants array

      • Optionalconfig: RequestConfig

        Optional request configuration to override defaults

      Returns Promise<any>

      Created group information

      // Create a new group
      const group = await client.createGroup({
      name: 'My Group',
      participants: [
      '1234567890@c.us',
      '0987654321@c.us',
      ],
      });

      console.log('Group created:', group.id);
      console.log('Group name:', group.subject);
    • Create a new session

      Creates a new WhatsApp session with the specified configuration. The session can be started immediately or configured for later use.

      Parameters

      • data: any

        Session configuration data including name and optional settings

      • Optionalconfig: RequestConfig

        Optional request configuration to override defaults

      Returns Promise<SessionInfo>

      Created session information

      // Create a new session
      const session = await client.createSession({
      name: 'my-new-session',
      config: {
      // Session-specific configuration
      },
      });

      console.log('Session created:', session.name);
    • Delete app

      Parameters

      • id: string

      Returns Promise<any>

    • Delete message

      Parameters

      Returns Promise<any>

    • Delete a session

      Permanently deletes a session and all its data. This action cannot be undone.

      Parameters

      • Optionalconfig: RequestConfig

        Optional request configuration to override defaults (including session name)

      Returns Promise<any>

      API response confirming deletion

      // Delete default session
      await client.deleteSession();

      // Delete a specific session
      await client.deleteSession({
      session: 'session-to-delete',
      });
    • Demote participant from admin

      Parameters

      Returns Promise<any>

    • Edit message

      Parameters

      • chatId: string
      • messageId: string
      • data: any
      • Optionalconfig: RequestConfig

      Returns Promise<any>

    • Get all contacts

      Parameters

      • Optionalparams: { limit?: number; offset?: number; sortBy?: string; sortOrder?: string }
      • Optionalconfig: RequestConfig

      Returns Promise<any>

    • Get app by ID

      Parameters

      • id: string

      Returns Promise<any>

    • Get all apps

      Returns Promise<any>

    • Get browser trace

      Parameters

      • sessionName: string

      Returns Promise<any>

    • Get chats

      Retrieves all chats (conversations) for the session, including individual chats and groups.

      Parameters

      • Optionalconfig: RequestConfig

        Optional request configuration to override defaults

      Returns Promise<ChatInfo[]>

      Array of chat information objects

      // Get all chats
      const chats = await client.getChats();

      // Filter for group chats
      const groups = chats.filter(chat => chat.isGroup);

      // Filter for individual chats
      const individuals = chats.filter(chat => !chat.isGroup);
    • Get Chatwoot locales

      Returns Promise<any>

    • Get contact profile picture

      Parameters

      • contactId: string
      • Optionalrefresh: boolean
      • Optionalconfig: RequestConfig

      Returns Promise<any>

    • Get group messages admin only setting

      Parameters

      Returns Promise<any>

    • Get all groups

      Retrieves all groups that the authenticated account is a member of.

      Parameters

      • Optionalconfig: RequestConfig

        Optional request configuration to override defaults

      Returns Promise<any>

      Array of group information objects

      // Get all groups
      const groups = await client.getGroups();

      groups.forEach(group => {
      console.log(`Group: ${group.subject} (${group.id})`);
      console.log(`Participants: ${group.participants.length}`);
      });
    • Get heap snapshot

      Returns Promise<any>

    • Get specific message

      Parameters

      Returns Promise<any>

    • Get messages from a chat

      Retrieves message history from a specific chat conversation.

      Parameters

      Returns Promise<MessageInfo[]>

      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

      Parameters

      • OptionalchatId: string
      • Optionallimit: number
      • OptionaldownloadMedia: boolean
      • Optionalconfig: RequestConfig

      Returns Promise<any>

    • Get QR code for pairing WhatsApp API

      Retrieves the QR code that can be scanned with WhatsApp mobile app to authenticate the session.

      Parameters

      • format: "image" | "raw" = 'image'

        Format of the QR code: 'image' returns a PNG image, 'raw' returns the raw QR code data

      • Optionalconfig: RequestConfig

        Optional request configuration to override defaults

      Returns Promise<any>

      QR code in the specified format

      // Get QR code as image
      const qrImage = await client.getQR('image');

      // Get raw QR code data
      const qrData = await client.getQR('raw');
    • Get server environment

      Returns Promise<any>

    • Get server status

      Returns Promise<any>

    • Get server version

      Returns Promise<any>

    • Get session information

      Retrieves detailed information about a specific session including its status, configuration, and WhatsApp account details.

      Parameters

      • Optionalconfig: RequestConfig

        Optional request configuration to override defaults (including session name)

      Returns Promise<SessionInfo>

      Session information including name, status, config, and me object

      // Get info for default session
      const session = await client.getSession();
      console.log('Session status:', session.status);
      console.log('My number:', session.me);

      // Get info for a specific session
      const customSession = await client.getSession({
      session: 'my-custom-session',
      });
    • Get session "me" info

      Retrieves information about the authenticated WhatsApp account for this session, including phone number, profile name, and other account details.

      Parameters

      • Optionalconfig: RequestConfig

        Optional request configuration to override defaults (including session name)

      Returns Promise<any>

      Account information for the authenticated session

      // Get my account info
      const me = await client.getSessionMe();
      console.log('My number:', me.id);
      console.log('My name:', me.pushname);
    • Get all sessions

      Lists all WhatsApp sessions configured on the WAHA server, including their current status.

      Parameters

      • Optionalconfig: RequestConfig

        Optional request configuration to override defaults

      Returns Promise<SessionInfo[]>

      Array of session information objects

      // Get all sessions
      const sessions = await client.getSessions();

      sessions.forEach(session => {
      console.log(`Session: ${session.name}, Status: ${session.status}`);
      });

      // Filter for active sessions
      const activeSessions = sessions.filter(s => s.status === 'WORKING');
    • Get API version

      Returns Promise<any>

    • Health check

      Returns Promise<any>

    • Join group

      Parameters

      Returns Promise<any>

    • Logout from a session (bulk operation)

      Parameters

      Returns Promise<any>

    • Ping endpoint

      Returns Promise<any>

    • Pin message

      Parameters

      • chatId: string
      • messageId: string
      • Optionaldata: any
      • Optionalconfig: RequestConfig

      Returns Promise<any>

    • Promote participant to admin

      Parameters

      Returns Promise<any>

    • React to a message

      Parameters

      • data: { chatId: string; messageId: string; reaction: string }
      • Optionalconfig: RequestConfig

      Returns Promise<any>

    • Mark chat messages as read

      Parameters

      Returns Promise<any>

    • Remove participants from group

      Parameters

      Returns Promise<any>

    • Request authentication code

      Requests an authentication code to be sent via SMS or voice call for phone number-based authentication.

      Parameters

      • data: { method?: string; phoneNumber: string }

        Object containing phoneNumber and optional method ('sms' or 'voice')

      • Optionalconfig: RequestConfig

        Optional request configuration to override defaults

      Returns Promise<any>

      Response indicating the code was sent

      // Request code via SMS
      await client.requestCode({
      phoneNumber: '+1234567890',
      method: 'sms',
      });

      // Request code via voice call
      await client.requestCode({
      phoneNumber: '+1234567890',
      method: 'voice',
      });
    • 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.

      Parameters

      • data: any

        Message data including chatId, text, and buttons

      • Optionalconfig: RequestConfig

        Optional request configuration

      Returns Promise<any>

      API response with message info, or null if number doesn't exist on WhatsApp

      const result = await client.safeSendButtons({
      chatId: '1234567890@c.us',
      text: 'Choose an option',
      buttons: [
      { id: '1', text: 'Option 1' },
      { id: '2', text: 'Option 2' },
      ],
      });
    • 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.

      Parameters

      • data: any

        Message data including chatId and contact information

      • Optionalconfig: RequestConfig

        Optional request configuration

      Returns Promise<any>

      API response with message info, or null if number doesn't exist on WhatsApp

      const result = await client.safeSendContactVcard({
      chatId: '1234567890@c.us',
      contactId: '0987654321@c.us',
      name: 'John Doe',
      });
    • Safely send a file message with anti-blocking measures

      This method implements WhatsApp's recommended anti-blocking guidelines:

      1. Checks if the number exists on WhatsApp before sending
      2. Sends "seen" indicator to appear more human-like
      3. Shows typing indicator with realistic delay
      4. Sends the actual file

      Parameters

      • params: SendFileParams

        Message parameters including chatId, file, optional filename and caption

      Returns Promise<APIResponse<MessageInfo> | null>

      API response with message info, or null if number doesn't exist on WhatsApp

      const result = await client.safeSendFile({
      chatId: '1234567890@c.us',
      file: 'https://example.com/document.pdf',
      filename: 'report.pdf',
      caption: 'Here is the report',
      });

      if (result === null) {
      console.log('Number does not exist on WhatsApp');
      } else {
      console.log('File sent:', result);
      }
    • Safely send an image message with anti-blocking measures

      This method implements WhatsApp's recommended anti-blocking guidelines:

      1. Checks if the number exists on WhatsApp before sending
      2. Sends "seen" indicator to appear more human-like
      3. Shows typing indicator with realistic delay
      4. Sends the actual image

      Parameters

      • params: SendImageParams

        Message parameters including chatId, file, and optional caption

      Returns Promise<APIResponse<MessageInfo> | null>

      API response with message info, or null if number doesn't exist on WhatsApp

      const result = await client.safeSendImage({
      chatId: '1234567890@c.us',
      file: 'https://example.com/image.jpg',
      caption: 'Check this out!',
      });

      if (result === null) {
      console.log('Number does not exist on WhatsApp');
      } else {
      console.log('Image sent:', result);
      }
    • 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.

      Parameters

      • data: any

        Message data including chatId and URL

      • Optionalconfig: RequestConfig

        Optional request configuration

      Returns Promise<any>

      API response with message info, or null if number doesn't exist on WhatsApp

      const result = await client.safeSendLinkPreview({
      chatId: '1234567890@c.us',
      url: 'https://example.com',
      title: 'Example Website',
      });
    • 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.

      Parameters

      • data: any

        Message data including chatId, title, and list sections

      • Optionalconfig: RequestConfig

        Optional request configuration

      Returns Promise<any>

      API response with message info, or null if number doesn't exist on WhatsApp

      const result = await client.safeSendList({
      chatId: '1234567890@c.us',
      title: 'Menu',
      sections: [
      {
      title: 'Main Dishes',
      rows: [
      { id: '1', title: 'Pizza', description: 'Delicious pizza' },
      ],
      },
      ],
      });
    • 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.

      Parameters

      • data: any

        Message data including chatId, latitude, and longitude

      • Optionalconfig: RequestConfig

        Optional request configuration

      Returns Promise<any>

      API response with message info, or null if number doesn't exist on WhatsApp

      const result = await client.safeSendLocation({
      chatId: '1234567890@c.us',
      latitude: 37.7749,
      longitude: -122.4194,
      title: 'San Francisco',
      });
    • 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.

      Parameters

      • data: any

        Message data including chatId, poll name, and options

      • Optionalconfig: RequestConfig

        Optional request configuration

      Returns Promise<any>

      API response with message info, or null if number doesn't exist on WhatsApp

      const result = await client.safeSendPoll({
      chatId: '1234567890@c.us',
      name: 'What's your favorite color?',
      options: ['Red', 'Blue', 'Green'],
      });
    • Safely send a text message with anti-blocking measures

      This method implements WhatsApp's recommended anti-blocking guidelines:

      1. Checks if the number exists on WhatsApp before sending
      2. Sends "seen" indicator to appear more human-like
      3. Shows typing indicator with realistic delay based on message length
      4. Sends the actual message

      Following these steps helps avoid being flagged as spam by WhatsApp.

      Parameters

      Returns Promise<APIResponse<MessageInfo> | null>

      API response with message info, or null if number doesn't exist on WhatsApp

      const result = await client.safeSendText({
      chatId: '1234567890@c.us',
      text: 'Hello! How are you?',
      });

      if (result === null) {
      console.log('Number does not exist on WhatsApp');
      } else {
      console.log('Message sent:', result);
      }
    • 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.

      Parameters

      • data: any

        Message data including chatId and video file

      • Optionalconfig: RequestConfig

        Optional request configuration

      Returns Promise<any>

      API response with message info, or null if number doesn't exist on WhatsApp

      const result = await client.safeSendVideo({
      chatId: '1234567890@c.us',
      file: 'https://example.com/video.mp4',
      caption: 'Check out this video',
      });
    • Safely send a voice message with anti-blocking measures

      This method implements WhatsApp's recommended anti-blocking guidelines:

      1. Checks if the number exists on WhatsApp before sending
      2. Sends "seen" indicator to appear more human-like
      3. Shows typing indicator with realistic delay
      4. Sends the actual voice message

      Parameters

      • data: any

        Message data including chatId and voice file

      • Optionalconfig: RequestConfig

        Optional request configuration

      Returns Promise<any>

      API response with message info, or null if number doesn't exist on WhatsApp

      const result = await client.safeSendVoice({
      chatId: '1234567890@c.us',
      file: 'https://example.com/voice.ogg',
      });

      if (result === null) {
      console.log('Number does not 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.

      Parameters

      • params: SendFileParams

        Message parameters including chatId, file, and optional filename/caption

        File message parameters

        Parameters for sending a file/document using sendFile() or safeSendFile().

        • Optionalcaption?: string

          Caption for the file (optional) Text that will be displayed with the file

        • chatId: string

          Chat ID to send message to Format: phone@c.us for individual chats, groupId@g.us for groups

        • Optionalconfig?: RequestConfig

          Optional request configuration override Allows overriding session, timeout, retry settings for this specific request

        • file: string

          File data (base64 or URL) Can be a URL (http/https) or base64-encoded file data with data URI scheme

        • Optionalfilename?: string

          Filename (optional) The name that will be shown for the file in WhatsApp

        • Optionalreply_to?: string

          Message ID to reply to (optional) If provided, the file will be sent as a reply to the specified message

      Returns Promise<APIResponse<MessageInfo>>

      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 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.

      Parameters

      • params: SendImageParams

        Message parameters including chatId, file, and optional caption

        Image message parameters

        Parameters for sending an image message using sendImage() or safeSendImage().

        • Optionalcaption?: string

          Caption for the image (optional) Text that will be displayed with the image

        • chatId: string

          Chat ID to send message to Format: phone@c.us for individual chats, groupId@g.us for groups

        • Optionalconfig?: RequestConfig

          Optional request configuration override Allows overriding session, timeout, retry settings for this specific request

        • file: string

          Image file data (base64 or URL) Can be a URL (http/https) or base64-encoded image data with data URI scheme

        • Optionalreply_to?: string

          Message ID to reply to (optional) If provided, the image will be sent as a reply to the specified message

      Returns Promise<APIResponse<MessageInfo>>

      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',
      });
    • Mark 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.

      Parameters

      • data: { chatId: string; messageId?: string }

        Object containing chatId and optional messageId

        • chatId: string

          Chat ID in format: phone@c.us (individual) or groupId@g.us (group)

        • OptionalmessageId?: string

          Optional specific message ID to mark as seen

      • Optionalconfig: RequestConfig

        Optional request configuration to override defaults

      Returns Promise<any>

      API response

      // Mark all messages in a chat as seen
      await client.sendSeen({
      chatId: '1234567890@c.us',
      });

      // Mark a specific message as seen
      await client.sendSeen({
      chatId: '1234567890@c.us',
      messageId: 'message-id-here',
      });
    • Send a text message

      Sends a plain text message to a chat. For better anti-spam protection, consider using safeSendText() instead.

      Parameters

      • params: SendTextParams

        Message parameters including chatId, text, and optional reply_to

        Text message parameters

        Parameters for sending a text message using sendText() or safeSendText().

        • chatId: string

          Chat ID to send message to Format: phone@c.us for individual chats, groupId@g.us for groups

        • Optionalconfig?: RequestConfig

          Optional request configuration override Allows overriding session, timeout, retry settings for this specific request

        • Optionalreply_to?: string

          Message ID to reply to (optional) If provided, the message will be sent as a reply to the specified message

        • text: string

          Text content of the message Plain text or text with WhatsApp formatting (e.g., bold, italic, ~strikethrough~)

      Returns Promise<APIResponse<MessageInfo>>

      API response with message information

      // Send a simple text message
      const response = await client.sendText({
      chatId: '1234567890@c.us',
      text: 'Hello, World!',
      });

      // Send a reply to a specific message
      const reply = await client.sendText({
      chatId: '1234567890@c.us',
      text: 'Thanks for your message!',
      reply_to: 'message-id-here',
      });
    • Send text message (alternative endpoint)

      Parameters

      • data: { chatId: string; session?: string; text: string }
      • Optionalconfig: RequestConfig

      Returns Promise<any>

    • Send text message via GET (alternative endpoint)

      Parameters

      Returns Promise<any>

    • Set chat labels

      Parameters

      Returns Promise<any>

    • Set group description

      Parameters

      Returns Promise<any>

    • Set group info admin only

      Parameters

      Returns Promise<any>

    • Set group messages admin only

      Parameters

      Returns Promise<any>

    • Set profile picture

      Parameters

      Returns Promise<any>

    • Set profile status (About)

      Parameters

      Returns Promise<any>

    • Star/unstar a message

      Parameters

      • data: { chatId: string; messageId: string; star: boolean }
      • Optionalconfig: RequestConfig

      Returns Promise<any>

    • Start a session

      Starts a WhatsApp session. The session will begin the authentication process (QR code or pairing code).

      Parameters

      • Optionalconfig: RequestConfig

        Optional request configuration to override defaults (including session name)

      Returns Promise<SessionInfo>

      Session information with updated status

      // Start default session
      const session = await client.startSession();

      // Start a specific session
      const customSession = await client.startSession({
      session: 'my-custom-session',
      });

      // After starting, get QR code to authenticate
      const qr = await client.getQR();
    • Start 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.

      Parameters

      • data: { chatId: string }

        Object containing chatId

      • Optionalconfig: RequestConfig

        Optional request configuration to override defaults

      Returns Promise<any>

      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

      Returns Promise<any>

    • Stop a session

      Stops a running WhatsApp session. This will disconnect the session but preserve its data for future use.

      Parameters

      • Optionalconfig: RequestConfig

        Optional request configuration to override defaults (including session name)

      Returns Promise<APIResponse<any>>

      API response confirming the session was stopped

      // Stop default session
      await client.stopSession();

      // Stop a specific session
      await client.stopSession({
      session: 'my-custom-session',
      });
    • 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.

      Parameters

      • data: { chatId: string }

        Object containing chatId

      • Optionalconfig: RequestConfig

        Optional request configuration to override defaults

      Returns Promise<any>

      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

      Parameters

      • Optionalsession: string

      Returns Promise<any>

    • Unblock contact

      Parameters

      Returns Promise<any>

    • Unpin message

      Parameters

      Returns Promise<any>

    • Update app

      Parameters

      • id: string
      • data: any

      Returns Promise<any>

    • Update contact

      Parameters

      Returns Promise<any>

    • Update session configuration

      Updates the configuration of an existing session. The session must be stopped before updating.

      Parameters

      • data: any

        Updated session configuration data

      • Optionalconfig: RequestConfig

        Optional request configuration to override defaults (including session name)

      Returns Promise<SessionInfo>

      Updated session information

      // Update session configuration
      const updated = await client.updateSession({
      webhooks: [
      {
      url: 'https://example.com/webhook',
      events: ['message'],
      },
      ],
      });