Overview
This node extends Mattermost functionality by allowing users to send direct messages (DMs) to other users within a Mattermost workspace. It is particularly useful for automating notifications, alerts, or personalized messages directly to specific users without manual intervention.
A common scenario includes sending automated status updates or reminders to team members based on workflow triggers. For example, after a task completes in another system, this node can send a direct message to the responsible user with relevant details.
Properties
| Name | Meaning |
|---|---|
| User ID | The identifier of the user who will receive the direct message. Examples: "user123" or an expression like {{$json.user_id}}. This is required. |
| Message | The content text of the direct message to be sent. This is required. |
Output
The node outputs JSON data representing the response from the Mattermost API after sending the message. The output JSON contains details about the posted message, including its unique ID and metadata returned by the API.
No binary data is produced by this node.
Dependencies
- Requires a valid Mattermost API authentication credential configured in n8n.
- The node makes HTTP requests to the Mattermost server's REST API endpoints:
- To get the current authenticated user's ID (
GET /api/v4/users/me) - To create a direct message channel between the sender and recipient (
POST /api/v4/channels/direct) - To post the message to the created direct message channel (
POST /api/v4/posts)
- To get the current authenticated user's ID (
Ensure the Mattermost instance URL and API credentials are correctly set up in n8n.
Troubleshooting
Common issues:
- Invalid or missing user ID: The node requires a valid target user ID; if incorrect, the API will return an error.
- Authentication failures: If the API key or credentials are invalid or expired, requests will fail.
- Permissions: The authenticated user must have permission to send direct messages to the specified user.
- Network or connectivity problems with the Mattermost server.
Error messages:
- Errors from the Mattermost API will be thrown if the user ID does not exist or the message cannot be posted.
- If "Continue On Fail" is enabled, errors will be returned as JSON objects with an
errorfield containing the message.
To resolve errors:
- Verify the user ID is correct and exists in the Mattermost workspace.
- Check that the API credentials are valid and have sufficient permissions.
- Confirm the Mattermost server URL is reachable from n8n.