WhatsApp Web API

WhatsApp Web API ile mesaj gönderme ve alma işlemleri

Overview

This node integrates with WhatsApp Web API to send messages directly to specified phone numbers. It is useful for automating communication workflows where sending text messages via WhatsApp is required, such as customer notifications, alerts, or marketing campaigns.

A practical example: Automatically sending order confirmation messages to customers after a purchase, by providing their phone number and a custom message.

Properties

Name Meaning
Phone Number The recipient's phone number in international format (without "+" sign).
Message The text content of the message to be sent to the recipient.

Output

The node outputs an array of JSON objects, each representing the result of sending a message for each input item. Each object contains:

  • success: Boolean indicating if the message was sent successfully.
  • status: A string message confirming success ("Message sent successfully").
  • phoneNumber: The phone number to which the message was sent.
  • content: The actual message text that was sent.

In case of failure (and if "Continue On Fail" is enabled), the output will contain an error message under the error field.

Dependencies

  • Requires connection to WhatsApp Web via the Baileys library (@whiskeysockets/baileys).
  • Stores authentication state locally in a folder named whatsapp-auth within the current working directory.
  • The node prints a QR code in the terminal for initial WhatsApp Web authentication.
  • No explicit external API keys are mentioned, but WhatsApp Web session authentication is necessary.

Troubleshooting

  • Common issues:

    • Failure to initialize the WhatsApp client if the authentication state is missing or corrupted.
    • Connection drops requiring re-authentication; the node attempts to reconnect automatically unless logged out.
    • Invalid phone number format may cause message sending to fail.
  • Error messages:

    • "WhatsApp client not initialized": Indicates the client failed to set up; ensure the environment allows file system access and the QR code authentication is completed.
    • Errors during message sending will include the underlying error message from the WhatsApp API. Enabling "Continue On Fail" allows processing subsequent items despite errors.

Links and References

Discussion