Green API icon

Green API

Send WhatsApp messages via Green API

Message → Human in the Loop

AI-generated

Overview

This node operation sends a WhatsApp message with interactive approval buttons (approve and reject) to a specified chat using the Green API. It waits for the user's response within a configurable timeout period. This is useful for scenarios where human approval or decision is required before proceeding, such as order confirmations, support ticket escalations, or sensitive action approvals.

Use Case Examples

  1. Sending a message to a customer asking for approval to proceed with an order, with buttons for 'Approve' and 'Reject'.
  2. Requesting user confirmation in a workflow before executing a critical operation, using interactive buttons and waiting for the response.

Properties

Name Meaning
Chat ID The WhatsApp chat identifier where the message with approval buttons will be sent. For private chats, use phone@c.us; for group chats, use chatId@g.us.
Message The text message content to send along with the approval buttons.
Approve Button Text The label text displayed on the approval button.
Reject Button Text The label text displayed on the rejection button.
Wait Timeout (Minutes) Duration in minutes to wait for the user's response before timing out. A value of 0 means no timeout.
Include Custom Data Flag indicating whether to include custom JSON data in the callback payload.
Custom Data Custom JSON data to include with the approval request, useful for passing additional context or metadata.
Override Credentials Option to override the default API credentials (instance ID and API token) for this specific operation.

Output

JSON

  • success - Indicates if the message was sent successfully.
  • mode - The mode of operation, here it is 'human_in_the_loop'.
  • requestId - Unique identifier for the approval request.
  • executionId - Execution ID of the current workflow run.
  • chatId - The chat ID where the message was sent.
  • originalMessage - The original text message sent to the user.
  • customData - Custom data included in the request, if any.
  • approveButtonText - Text label of the approve button.
  • rejectButtonText - Text label of the reject button.
  • waitTimeout - Configured wait timeout in minutes for user response.
  • timestamp - Timestamp when the message was sent.
  • sentMessage - Response data from the API about the sent message.
  • webhook - Details about the webhook URLs and setup for receiving user responses.
  • buttonMapping
    • approve - Mapping key for the approve button action.
    • reject - Mapping key for the reject button action.
  • info
    • messagesSent - Number of messages sent (should be 1).
    • buttonsCreated - Number of interactive buttons created (should be 2).
    • webhookReady - Indicates if the webhook is ready to receive responses.
    • workflowOrder - Description of the workflow order involving this node.
    • parallelSupport - Information about parallel execution support for webhooks.
    • nextSteps - Suggested next steps for workflow continuation after this node.

Dependencies

  • Green API credentials (instance ID and API token)

Troubleshooting

  • Ensure the chat ID is correctly formatted (e.g., phone@c.us for private chats).
  • Verify that the API credentials (instance ID and API token) are valid and have the necessary permissions.
  • Check that the custom JSON data is valid JSON if 'Include Custom Data' is enabled.
  • If the message fails to send, review the error message for details and verify the data sent matches the API requirements.
  • Make sure the webhook URL is correctly configured and accessible to receive user responses within the timeout period.

Discussion