WhatsApp API WebSocket Trigger icon

WhatsApp API WebSocket Trigger

Receive WhatsApp events via WebSocket connection

WhatsApp API WebSocket Trigger

AI-generated

Summary

Listen for specified WhatsApp events in real time by connecting to a configured WebSocket server and session ID.

Inputs

  • WebSocket URL (required) — The URL of the WhatsApp API WebSocket server to connect to.
  • Session ID (required) — The WhatsApp session ID to join and receive events from.
  • Event Types — One or more event types to listen for, such as message received, session ready, QR code updates, message acknowledgments, or session status changes.
  • Reconnection — Whether to automatically attempt to reconnect if the WebSocket connection is lost.
  • Reconnection Attempts — The maximum number of reconnection attempts before giving up (0 means infinite attempts). Only applicable if reconnection is enabled.
  • Reconnection Delay — Initial delay in milliseconds before attempting to reconnect. Only applicable if reconnection is enabled.

Output shape

a stream of event objects emitted as JSON arrays with fields: event (event type), sessionId, timestamp (in ms), and data (event payload).

Events are emitted for each configured event type received over the WebSocket. The trigger maintains the connection based on reconnection settings and joins the specified session room to filter events. On closing, the connection is cleanly disconnected from the session.

Discussion