Green API icon

Green API

Send WhatsApp messages via Green API or trigger workflows on webhooks

Overview

The node enables sending WhatsApp poll messages via the Green API service. It allows users to create interactive polls within WhatsApp chats, where recipients can vote on multiple-choice questions. This is useful for gathering opinions, conducting surveys, or making group decisions directly through WhatsApp.

Typical use cases include:

  • Sending quick polls to a group chat to decide on meeting times.
  • Collecting feedback from customers or team members.
  • Running informal surveys in private chats or groups.

For example, a user can send a poll with options like "Option 1, Option 2, Option 3" to a specific chat ID, optionally allowing multiple answers.

Properties

Name Meaning
Mode Select between "Action" (execute WhatsApp actions) or "Listen for Incoming Webhook" (trigger workflows on incoming webhooks). For sending polls, use "Action".
Chat ID The target chat identifier. Use phone@c.us format for private chats or chatId@g.us for groups.
Message The text message that accompanies the poll question.
Poll Options Comma-separated list of poll options (between 2 and 12 options).
Multiple Answers Boolean flag indicating whether the poll allows multiple answers per participant.
Quoted Message ID Optional ID of a message to quote when sending the poll (for context or reply).

Output

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

The JSON typically contains confirmation details about the sent poll message, such as message IDs or status information returned by the API.

No binary data output is produced by this operation.

Dependencies

  • Requires an active Green API account with valid credentials: an instance ID and an API token.
  • The node makes HTTP POST requests to Green API endpoints using these credentials.
  • No additional environment variables are needed beyond the configured API credentials in n8n.

Troubleshooting

  • Common issues:

    • Invalid or missing chat ID format will cause the API request to fail.
    • Providing fewer than 2 or more than 12 poll options may result in errors.
    • Network or authentication failures if API credentials are incorrect or expired.
  • Error messages:

    • "Failed to send poll: <error message>" indicates an issue with the API call. Check the error message for details.
    • Errors also include the data sent to the API for easier debugging.
    • If the node is set to "trigger" mode but used as an action, it throws an error instructing to use it correctly.
  • Resolution tips:

    • Verify chat ID formats and ensure they match WhatsApp standards.
    • Confirm poll options count and formatting.
    • Double-check API credentials and network connectivity.
    • Use the quoted message ID only if referencing an existing message.

Links and References


This summary covers the "Send Poll" operation of the "Message" resource in the Green API node, focusing on its execute method logic and relevant properties.

Discussion