WSAPI Trigger icon

WSAPI Trigger

Trigger on WSAPI webhook events (messages, chats, calls, users, etc.)

Overview

This node acts as a webhook trigger for WSAPI events, specifically designed to listen for various message-related events such as new messages, message reads, deletions, stars, and initial message history syncs. It is useful in scenarios where you want to automate workflows based on real-time messaging activity, for example:

  • Automatically processing or responding to incoming messages.
  • Tracking when messages are read or deleted.
  • Archiving starred messages.
  • Syncing message history during device pairing.

The node listens for selected message event types via a webhook and can optionally download media files attached to messages automatically.

Properties

Name Meaning
Message Events Select which message events to listen for. Options: Message, Message Read, Message Deleted, Message Starred, Message History Sync.
Auto-Download Media Boolean option to automatically download media files when message events contain media.
Parse Event Data Boolean option to parse the event data based on event type for easier access to individual fields.
Include Raw Event Boolean option to include the original webhook payload in the output for full raw data inspection.
Webhook Authentication Enable custom header authentication for incoming webhooks.
Auth Header Name Custom header name used for webhook authentication (required if authentication enabled).
Auth Header Value Expected value of the authentication header to validate incoming webhook requests (required if enabled).

Output

The node outputs JSON data representing the received event with the following structure:

  • instanceId: Identifier of the instance sending the event.
  • receivedAt: Timestamp when the event was received.
  • eventType: The type of message event triggered.
  • Parsed event data fields merged directly into the output object if parsing is enabled.
  • If parsing is disabled, the raw eventData object is included under the eventData key.
  • Optionally, the original raw webhook payload is included under rawEvent if enabled.
  • If auto-download of media is enabled and the event contains media, the binary data of the media file is included in the output under a binary property with metadata such as filename and MIME type.
  • Additional metadata about media download status (downloadedAt, autoDownloaded) or errors (downloadError) is added to the event data when applicable.

Dependencies

  • Requires an API key credential for WSAPI to download media files when auto-download is enabled.
  • Needs proper webhook setup to receive POST requests from the WSAPI service.
  • Optional webhook authentication requires configuring a custom header name and expected value to secure incoming webhook calls.

Troubleshooting

  • Webhook Authentication Failure: If enabled, ensure that the incoming webhook request includes the correct custom header with the expected value; otherwise, the node will ignore the request.
  • Missing Event Data: The node expects the webhook payload to contain eventType and eventData. If these are missing, the webhook response will be ignored.
  • Unsupported Event Type: If the event type received is not among the selected message events, the node will not trigger.
  • Media Download Failures: When auto-download is enabled, failures to download media (e.g., due to invalid credentials or network issues) will be recorded in the output event data under a downloadError field.
  • Credential Configuration: Ensure the API key credential is correctly set up with valid base URL, API key, and instance ID for media downloads.

Links and References

Discussion