WhatsApp API icon

WhatsApp API

Integração com WhatsApp API para envio de mensagens e gerenciamento

Overview

This node integrates with a WhatsApp API to manage communication and related entities such as messages, contacts, tickets, sessions, and opportunities. Specifically for the Ticket - Create operation, it allows users to create a new support or service ticket associated with a WhatsApp contact. This is useful in scenarios where customer support teams want to automatically generate tickets from WhatsApp conversations or initiate tickets programmatically.

Practical examples include:

  • Automatically creating a support ticket when a customer sends a message on WhatsApp.
  • Initiating a ticket for follow-up based on external triggers integrated via n8n workflows.

Properties

Name Meaning
User ID Numeric identifier of the user responsible for the ticket.

Note: For the Ticket Create operation, the node also uses these implicit properties (not listed in your JSON but visible in code):

  • body: The content or description of the ticket (defaulted to "Ticket criado via N8N" if not provided).
  • contactNumber: The WhatsApp number associated with the ticket.
  • externalKey: A unique key for system identification, auto-generated if not provided.
  • status: Always set to "pending" upon creation.

Output

The node outputs an array of JSON objects corresponding to each input item processed. Each output object contains the response from the WhatsApp API after attempting to create the ticket. The structure typically includes details about the created ticket such as its ID, status, and any metadata returned by the API.

If an error occurs and the node is configured to continue on failure, the output will contain an error field with the error message instead of the usual ticket data.

No binary data output is produced by this operation.

Dependencies

  • Requires connection credentials to the WhatsApp API, including:
    • Base URL of the API.
    • Instance ID identifying the WhatsApp instance.
  • The node expects these credentials to be configured in n8n under a generic API authentication token or API key credential.
  • The API must support endpoints for ticket creation at /v2/api/external/{instanceId}/createTicket.

Troubleshooting

  • Common issues:

    • Missing or invalid API credentials will cause authentication failures.
    • Incorrect or missing required parameters like userId, contactNumber, or body may result in API errors.
    • Network connectivity problems can prevent successful requests.
  • Error messages:

    • Authentication errors usually indicate invalid or expired API keys; verify and update credentials.
    • Validation errors from the API often specify which parameter is missing or malformed; ensure all required fields are correctly set.
    • If the node throws an unknown error, enabling "Continue On Fail" can help isolate problematic inputs.

Links and References

Discussion