WSAPI Trigger icon

WSAPI Trigger

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

Overview

This node acts as a webhook trigger for user-related events from a WSAPI (WebSocket API) system. It listens for specific user events such as updates to the user's display name, status message, profile picture, or online presence. When one of the selected events occurs, the node triggers and outputs the event data.

Common scenarios where this node is useful include:

  • Automating workflows based on user profile changes, e.g., updating a CRM when a user changes their display name or profile picture.
  • Monitoring user presence status to trigger notifications or update dashboards.
  • Logging or auditing user status updates in real-time.

Practical example: A company wants to track when users update their profile pictures to automatically refresh their profiles in an internal directory. This node can listen for the "User Picture" event and trigger a workflow that downloads the new picture and updates the directory.

Properties

Name Meaning
User Events Select which user events to listen for. Options: User Push Name, User Status, User Picture, User Presence
Parse Event Data Whether to parse the eventData field for easier access to its fields (true/false)
Include Raw Event Whether to include the original webhook payload in the output (true/false)
Webhook Authentication Enable custom header authentication for incoming webhooks (true/false)
Auth Header Name Custom header name used for webhook authentication (string, required if auth enabled)
Auth Header Value Expected value for the authentication header (string, required if auth enabled)

Output

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

  • instanceId: Identifier of the WSAPI instance.
  • receivedAt: Timestamp when the event was received.
  • eventType: The type of user event triggered (e.g., user_push_name).
  • 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 property.
  • Optionally, the original raw webhook payload is included under rawEvent if enabled.

If the event is a message event containing media and auto-download is enabled (not applicable here since resource is user), the node attempts to download the media file and includes it as binary data in the output.

Dependencies

  • Requires an optional API key credential to authenticate requests for downloading media files (though media download is not relevant for user events).
  • The node expects to receive webhook POST requests at a configured path.
  • If webhook authentication is enabled, the node requires a custom header name and expected value to validate incoming requests.

Troubleshooting

  • Webhook Authentication Failure: If authentication is enabled but the incoming request does not contain the expected header or value, the node will ignore the webhook without response. Ensure the webhook sender includes the correct header and value.
  • Missing Event Data: If the webhook payload lacks eventType or eventData, the node will not trigger. Verify the webhook source sends complete event information.
  • Unsupported Event Type: If the event type received is not among the selected user events, the node ignores the webhook. Confirm the node's event selection matches the events sent by the webhook.
  • Media Download Errors: Although not typical for user events, if media download is attempted and fails, the error is recorded in the output but does not stop the workflow. Check API credentials and network connectivity.

Links and References

Discussion