Green API icon

Green API

Send WhatsApp messages via Green API or trigger workflows on webhooks

Overview

This node enables sending WhatsApp contact messages via the Green API service. It is designed to send a contact card to a specified chat on WhatsApp, which can include phone number, first name, middle name, last name, and company information. This operation is useful in scenarios where you want to share contact details programmatically within WhatsApp conversations, such as automating customer support contacts, sharing team member info, or distributing business cards.

For example, you could use this node to automatically send a sales representative's contact details to a client after a form submission or to share emergency contact information in a group chat.

Properties

Name Meaning
Mode Selects the mode of operation: "Action" to execute WhatsApp actions or "Listen for Incoming Webhook" to trigger workflows on incoming webhooks. For sending contacts, "Action" mode is used.
Chat ID The identifier of the WhatsApp chat where the contact will be sent. Use phone@c.us format for private chats or chatId@g.us for groups.
Phone Contact The phone number of the contact to send, in international format without the plus sign (e.g., 79001234567). This is required.
First Name The first name of the contact (optional).
Middle Name The middle name of the contact (optional).
Last Name The last name of the contact (optional).
Company The company name associated with the contact (optional).
Quoted Message ID Optional ID of a message to quote when sending the contact message, allowing contextual replies.

Output

The node outputs an array of JSON objects representing the response from the Green API after attempting to send the contact message. Each output item corresponds to one input item processed.

The JSON output typically contains confirmation details or error information returned by the Green API about the sent contact message.

No binary data output is produced by this operation.

Dependencies

  • Requires valid credentials for the Green API service, including an instance ID and an API token.
  • The node makes HTTP POST requests to the Green API endpoints to perform actions.
  • No additional external dependencies are needed beyond standard n8n credential configuration for API access.

Troubleshooting

  • Common Issues:

    • Invalid or missing API credentials will cause authentication failures.
    • Incorrectly formatted Chat ID or phone numbers may result in errors or message delivery failure.
    • Network connectivity issues can prevent successful API calls.
    • Missing required parameters like Chat ID or Phone Contact will cause validation errors.
  • Error Messages:

    • Errors from the Green API are caught and rethrown with detailed messages including the failed request data, e.g., Failed to send contact: <error message> Data sent: <JSON payload>.
    • If the node is configured as a trigger but used as an action, it throws an error instructing to use it correctly.
  • Resolution Tips:

    • Verify that the API credentials are correct and active.
    • Ensure phone numbers and chat IDs follow the expected formats.
    • Check network connectivity and firewall settings.
    • Review the error message details to identify incorrect or missing parameters.

Links and References

Discussion