Overview
This node implements a Mattermost event trigger with enhanced WebSocket handling, including automatic reconnection and heartbeat monitoring. It listens to real-time events from a Mattermost server via WebSocket, allowing workflows to react instantly to various Mattermost activities such as team updates, channel changes, user actions, posts, reactions, and more.
Common scenarios where this node is beneficial include:
- Automating responses or notifications when specific Mattermost events occur (e.g., new messages, user joins).
- Synchronizing Mattermost data with other systems in real time.
- Monitoring system or plugin events for auditing or analytics.
- Reacting to custom or less common events by specifying them explicitly.
Practical example: A workflow that triggers whenever a new post is created in a channel, automatically sending a summary to another communication platform or logging it for compliance.
Properties
| Name | Meaning |
|---|---|
| Resources | Select which categories of Mattermost events to receive. Options: All, Team, Other, Channel, SystemEvent, Role, User, Plugin, Post, UserPreference, Reaction, Thread |
| Events | Select specific events to receive within the chosen resources. The list dynamically loads based on selected resources. |
| Custom Events | Specify additional custom event names as a comma-separated string to listen for events not covered by the predefined options. |
Output
The node outputs an array of JSON objects representing the received Mattermost events. Each output item corresponds to one event message received over the WebSocket connection. The JSON structure includes fields such as:
event: The event name (e.g., "post_created", "user_added").data: Event-specific payload containing detailed information about the event.seq: Sequence number of the event message.- Other metadata fields depending on the event type.
The node does not output binary data; all outputs are JSON objects representing event data.
Dependencies
- Requires a valid API token credential for authenticating with the Mattermost server.
- Needs the base URL of the Mattermost instance.
- Uses WebSocket protocol to connect to the Mattermost WebSocket endpoint.
- The node depends on the
wslibrary for WebSocket client functionality. - Requires proper network access to the Mattermost server's WebSocket endpoint.
- The node configuration must include the API token and base URL credentials.
Troubleshooting
- Connection Timeout: If the node fails to connect within 30 seconds, it will timeout and attempt to reconnect with exponential backoff. Ensure the base URL and token are correct and the server is reachable.
- Authentication Failure: If the token is invalid or expired, the WebSocket connection will not authenticate. Verify the API token credential.
- WebSocket Errors: Network interruptions or server-side issues may cause connection drops. The node automatically attempts to reconnect with increasing delays.
- Event Filtering: If no events are received, check that the selected resources and events match those emitted by your Mattermost instance. Use the "Custom Events" property to listen for any missing event types.
- Heartbeat Failures: The node sends periodic ping frames and expects pong responses to keep the connection alive. Failure to receive pong within 10 seconds causes connection termination and reconnection. Network latency or firewall rules blocking WebSocket pings/pongs can cause issues.