2Chat Trigger icon

2Chat Trigger

Triggers on 2Chat events (messages, status updates, etc.)

Overview

This node acts as a trigger for events from the 2Chat platform, specifically related to WhatsApp messaging. It listens for specified WhatsApp message events on a connected 2Chat number and triggers workflows when those events occur. Common use cases include automating responses to incoming WhatsApp messages, logging conversations, or integrating WhatsApp communication into broader business processes.

For example, you can use this node to start a workflow whenever a new WhatsApp message is received or sent through your 2Chat account, enabling automated customer support replies or message analytics.

Properties

Name Meaning
Events The specific WhatsApp events to listen for. Options:
- Whatsapp Message Received: Triggers on receiving a WhatsApp message.
- Whatsapp Message: Triggers on any new WhatsApp message sent or received (including agent and user messages).
WhatsApp Number Name or ID Limits the trigger to a specific WhatsApp number connected to 2Chat. You can select from a list of available numbers or specify an ID using an expression.

Output

The node outputs JSON data representing the event payload received from 2Chat. This includes all details about the WhatsApp message event, augmented with:

  • receivedAt: Timestamp in ISO format indicating when the webhook was received.
  • webhookEvent: The type of event triggered (e.g., "whatsapp.message.new" or "unknown" if not specified).

The output is structured as an array of JSON objects, each corresponding to an event captured by the webhook.

The node does not output binary data.

Dependencies

  • Requires a valid API authentication credential for the 2Chat service.
  • Needs network access to 2Chat's API endpoints to manage webhooks.
  • The node uses n8n's webhook mechanism to receive event notifications from 2Chat.
  • The WhatsApp numbers available for selection are dynamically loaded via an API call.

Troubleshooting

  • Webhook creation failure: If the node cannot create the webhook subscription, ensure that the API credentials are correct and have sufficient permissions. Also, verify that the selected WhatsApp number is valid and connected.
  • No events triggering: Confirm that the selected events match those sent by 2Chat and that the webhook URL is correctly registered in 2Chat.
  • Invalid response during webhook existence check: This may indicate connectivity issues or API changes; check network access and API status.
  • Error messages related to API requests: These usually stem from authentication errors, invalid parameters, or rate limits. Review the error details and adjust credentials or request parameters accordingly.

Links and References

Discussion