Actions7
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
eventDataobject is included under theeventDatakey. - Optionally, the original raw webhook payload is included under
rawEventif 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
eventTypeandeventData. 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
downloadErrorfield. - 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
- WSAPI official documentation (for event types and webhook setup) — [Not provided in source]
- n8n webhook trigger documentation — https://docs.n8n.io/nodes/n8n-nodes-base.webhook/
- Handling binary data in n8n — https://docs.n8n.io/integrations/binary-data/