No description
  • Python 98.7%
  • Just 1.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Eddy Hintze afa90d211d
All checks were successful
Tag & Publish / tag-and-publish (push) Successful in 4s
feat: add tag and publish workflow for PyPI
2026-03-07 08:54:56 -05:00
.forgejo/workflows feat: add tag and publish workflow for PyPI 2026-03-07 08:54:56 -05:00
fw_nodes_mattermost feat: enhance Mattermost Post Message node to support file attachments 2026-03-07 08:46:14 -05:00
tests feat: enhance Mattermost Post Message node to support file attachments 2026-03-07 08:46:14 -05:00
.gitignore Add Mattermost node implementations and tests 2026-01-16 21:51:19 -05:00
justfile Update README.md and justfile for installation instructions and add publish command 2026-01-20 18:41:36 -05:00
LICENSE Update copyright year in LICENSE file to 2026 2026-02-28 14:28:36 -05:00
pyproject.toml version bump 2026-03-05 20:18:35 -05:00
README.md feat: enhance Mattermost Post Message node to support file attachments 2026-03-07 08:46:14 -05:00

Flowire Mattermost Nodes

PyPI version

Mattermost integration nodes for Flowire workflow automation. This package provides nodes for receiving and sending messages with Mattermost.

Installation

cd flowire-app/backend
uv pip install fw-nodes-mattermost

Then enable the package in your .env file:

# .env (comma-separated list)
INSTALLED_NODE_PACKAGES=fw-nodes-core,fw-nodes-mattermost

Included Nodes

Triggers

Node Description
Mattermost Events Receive real-time events (messages, reactions, etc.) via WebSocket
Mattermost Outgoing Webhook Receive messages from Mattermost channels via outgoing webhooks
Mattermost Slash Command Receive slash command invocations from Mattermost

Actions

Node Description
Mattermost Post Message Post a message to a Mattermost channel (supports file attachments)
Mattermost Add Reaction Add an emoji reaction to a post

Usage Examples

Mattermost Events (WebSocket)

Receive real-time events from Mattermost via WebSocket connection. Channels are populated dynamically from the selected credential.

# Node configuration:
{
    "credential_id": "your-mattermost-credential",
    "events": ["posted", "reaction_added", "reaction_removed"],
    "channels": ["channel-id-1", "channel-id-2"],  # Optional: filter by channel (dynamic dropdown)
    "teams": ["team-id"]  # Optional: filter by team
}

# Outputs:
# - event_type: Type of event (posted, reaction_added, etc.)
# - user_id: User who triggered the event
# - channel_id: Channel where event occurred
# - team_id: Team where event occurred
# - post_id: Post ID (for posted/reaction events)
# - message: Message content (for posted events)
# - emoji_name: Emoji name (for reaction events)
# - sender_name: Username of the sender
# - raw_event: Full event payload

Advantages over webhooks:

  • Real-time events with no polling delay
  • Captures events webhooks can't (typing, status changes, etc.)
  • No webhook configuration required in Mattermost admin

Outgoing Webhook

Receive channel messages when a trigger word is used:

# Node configuration:
{
    "validate_token": true,
    "token": "{{project.mattermost-webhook-token}}"
}

# Outputs:
# - text: The message content
# - user_name: Who posted the message
# - channel_name: Where it was posted
# - trigger_word: The word that triggered the webhook

Slash Command

Receive slash command invocations (e.g., /mycommand args):

# Node configuration:
{
    "validate_token": true,
    "token": "{{project.mattermost-slash-token}}"
}

# Outputs:
# - command: The slash command (e.g., "/weather")
# - text: Arguments after the command
# - user_name: Who invoked the command
# - response_url: URL for delayed responses

Post Message

Send messages to Mattermost channels. Channels are populated dynamically from the selected credential.

# Node configuration:
{
    "credential_id": "your-mattermost-credential",
    "channel_id": "{{slash-command.channel_id}}",
    "message": "Hello from Flowire! Processing your request...",
    "root_id": "{{slash-command.post_id}}",  # Optional: reply in thread
    "attachment": "{{prev-node.file}}"  # Optional: attach a file (storage reference)
}

Add Reaction

Add an emoji reaction to a Mattermost post:

# Node configuration:
{
    "credential_id": "your-mattermost-credential",
    "post_id": "{{stream-trigger.post_id}}",
    "emoji_name": "thumbsup"  # Without colons
}

# Outputs:
# - user_id: User who added the reaction
# - post_id: Post the reaction was added to
# - emoji_name: Emoji name
# - success: Whether the reaction was added

Mattermost Setup

Outgoing Webhook

  1. Go to Integrations > Outgoing Webhooks in Mattermost
  2. Click Add Outgoing Webhook
  3. Set the callback URL to your Flowire webhook endpoint
  4. Configure trigger words or channels
  5. Copy the token and store it as a project variable

Slash Command

  1. Go to Integrations > Slash Commands in Mattermost
  2. Click Add Slash Command
  3. Set the request URL to your Flowire webhook endpoint
  4. Configure the command (e.g., /mycommand)
  5. Copy the token and store it as a project variable

Credentials (Post Message, Add Reaction, Events)

  1. In Mattermost, go to Account Settings > Security > Personal Access Tokens
  2. Generate a new token with appropriate permissions
  3. In Flowire, create a Mattermost credential with:
    • Server URL: Your Mattermost server (e.g., https://mattermost.example.com)
    • Access Token: The personal access token

Development

# Install with dev dependencies
uv sync --all-extras

# Run linter
ruff check .

# Auto-fix lint issues
ruff check . --fix

# Format code
ruff format .

# Run tests
pytest

Project Structure

fw-nodes-mattermost/
├── fw_nodes_mattermost/
│   ├── __init__.py
│   ├── api.py                # Shared API helpers (channel fetching, etc.)
│   ├── credentials.py        # Mattermost credential schema
│   ├── handlers/
│   │   ├── __init__.py
│   │   └── mattermost_ws.py  # WebSocket stream handler
│   ├── nodes/
│   │   ├── __init__.py
│   │   ├── add_reaction.py
│   │   ├── outgoing_webhook.py
│   │   ├── post_message.py
│   │   ├── slash_command.py
│   │   └── stream_trigger.py
│   └── utils/
│       ├── __init__.py
│       └── token_validation.py
├── tests/
├── pyproject.toml
└── README.md

License

This project is licensed under the MIT License.