MegaAPI icon

MegaAPI

Interact with MegaAPI WhatsApp service - send messages, manage instance, configure webhooks

Overview

The Process Webhook to Chatwoot operation in this node is designed to handle incoming webhook payloads from MegaAPI (a WhatsApp service) and synchronize or create messages within Chatwoot, a customer engagement platform. This operation automates the integration between WhatsApp events received via MegaAPI webhooks and Chatwoot conversations, enabling seamless message flow and contact management.

Typical use cases include:

  • Automatically creating or updating contacts in Chatwoot when new WhatsApp messages arrive.
  • Creating new conversations in Chatwoot if none exist for an incoming message.
  • Logging WhatsApp messages into Chatwoot conversations for unified customer communication tracking.

For example, when a WhatsApp message is received by MegaAPI and sent as a webhook event, this node can process that event, check if the contact exists in Chatwoot, create it if necessary, then create or update the conversation and add the message content accordingly.

Properties

Name Meaning
Input Required ⚠️ Notice that this operation requires a MegaAPI webhook payload as input. Connect this node to a Webhook node receiving data from MegaAPI.
Chatwoot Account ID Your Chatwoot account identifier where messages and contacts will be managed.
Chatwoot Inbox ID The specific Chatwoot inbox ID used for WhatsApp messages, defining the target inbox for conversations.
Options Collection of boolean options:
• Create Contact If Not Exists — Whether to create a contact if it does not already exist.
• Create Conversation If Not Exists — Whether to create a conversation if none exists.
• Log Detailed Steps — Enable detailed logging of processing steps for debugging or audit purposes.

Output

The node outputs an array with one item per input, each containing JSON data representing the result of processing the MegaAPI webhook into Chatwoot. The exact structure depends on the internal implementation but typically includes:

  • Confirmation of contact creation or update.
  • Details of conversation creation or retrieval.
  • Message creation status and metadata.
  • Any errors encountered during processing (if continueOnFail is enabled).

No binary data output is indicated for this operation.

Dependencies

  • Requires a valid MegaAPI webhook payload as input, typically connected from an n8n Webhook node configured to receive MegaAPI events.
  • Requires configuration of Chatwoot account credentials and access to the specified Chatwoot account and inbox.
  • Network connectivity to both MegaAPI webhook source and Chatwoot API endpoints.
  • No explicit environment variables are mentioned, but API authentication tokens or keys for Chatwoot must be configured securely in n8n credentials.

Troubleshooting

  • Missing or malformed webhook payload: The operation expects a MegaAPI webhook payload. Ensure the input data matches the expected format; otherwise, processing will fail.
  • Invalid Chatwoot Account or Inbox ID: Incorrect IDs will cause API calls to Chatwoot to fail. Verify these values carefully.
  • Contact or Conversation creation disabled: If the options to create contacts or conversations are disabled, incoming messages without existing records may not be processed correctly.
  • API authentication errors: Ensure that the Chatwoot API credentials are valid and have sufficient permissions.
  • Logging disabled: If troubleshooting issues, enable "Log Detailed Steps" to get more insight into the processing flow.
  • NodeOperationError exceptions: These indicate unknown resource or operation parameters or other internal validation failures. Double-check the selected Resource and Operation settings.

Links and References

Discussion