WAHA API icon

WAHA API

Complete WhatsApp automation with WAHA API - Multi-engine support

Overview

This node integrates with the WAHA API to automate WhatsApp messaging and session management. Specifically, the "Send Contact" operation under the "Message" resource allows users to send a contact vCard to a specified WhatsApp chat. This is useful for sharing contact information directly within WhatsApp conversations, such as sending business cards or personal contacts.

Practical examples include:

  • Automatically sending a customer support contact card when a user initiates a chat.
  • Sharing team member contact details in group chats.
  • Distributing event organizer contacts during event-related conversations.

Properties

Name Meaning
Session Name The name of the WhatsApp session to use for sending the message. Defaults to a preset session.
Chat ID The WhatsApp chat identifier where the contact will be sent. Format: phone number with @c.us or group ID with @g.us.
Additional Fields Collection of optional fields:
- Contact Name: Name to display on the vCard (default "Contact").
- Contact Number: Phone number included in the vCard.
- Other fields like filename, mimetype, link description/title, reaction emoji, limit, and download media are available but not relevant for this operation.

Output

The node outputs a JSON object representing the response from the WAHA API after attempting to send the contact vCard. This typically includes status information about the message delivery or any errors encountered.

No binary data output is produced by this operation.

Example output structure:

{
  "status": "success",
  "messageId": "some-message-id",
  "chatId": "5511999999999@c.us",
  "timestamp": "2024-06-01T12:00:00Z"
}

Dependencies

  • Requires an active WAHA API credential with a valid base URL and API key.
  • Optionally uses an additional API key credential for subscription validation via the n8n Tools API.
  • The WhatsApp session must be active and connected to send messages.
  • Proper configuration of the session name and chat ID is necessary.

Troubleshooting

  • Invalid Subscription or API Key: If the node throws an error related to invalid subscription or API key, verify that both the WAHA API credentials and the optional n8n Tools API credentials are correctly set and active.
  • Unknown Operation or Resource Errors: These occur if unsupported operations or resources are selected. Ensure the operation is "Send Contact" and the resource is "Message".
  • Chat ID Format Issues: The chat ID must be correctly formatted (e.g., 5511999999999@c.us). Incorrect formatting will cause message sending failures.
  • Session Not Active: If the session name does not correspond to an active WhatsApp session, the API call will fail. Confirm the session is started and connected.
  • Missing Contact Name or Number: While defaults exist, providing meaningful contact name and number improves the vCard quality and reduces errors.

Links and References

Discussion