Skip to main content

Analyze Mattermost attachments with OpenAI vision for AI agents

Workflow preview

Workflow preview
100%
Analyze Mattermost attachments with OpenAI vision for AI agents preview
Open on n8n.io

1. Workflow Overview

Overview Subworkflow for analyzing Mattermost attachments. Per attachment behavior Image (mime starts with , size ≤ ): downloaded and analyzed by OpenAI vision model. Text small (text like by mime/...

Best for

  • Document Extraction automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.stickynote, n8n-nodes-base.executeworkflowtrigger, n8n-nodes-base.set, n8n-nodes-base.if, n8n-nodes-base.code, n8n-nodes-base.httprequest, n8n-nodes-base.switch, @n8n/n8n-nodes-langchain.openai

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Sergei Byvshev.

Original n8n.io source

1.1 Workflow description

Title
Analyze Mattermost attachments with OpenAI vision for AI agents
Workflow name
Analyze Mattermost attachments with OpenAI vision for AI agents

Overview

Subworkflow for analyzing Mattermost attachments.

Per-attachment behavior

  • Image (mime starts with image/, size ≤ MAX_IMAGE_SIZE_BYTES): downloaded and analyzed by OpenAI vision model.
  • Text small (text-like by mime/extension, size ≤ MAX_TEXT_SIZE_BYTES): downloaded as plain text and inlined into the context block (with line count check ≤ MAX_TEXT_LINES).
  • Text too large (text-like, exceeds byte or line limit): replaced with a "too big" marker so the agent asks the user for the relevant excerpt.
  • Other (binaries, oversized images, unknown): replaced with a generic "not analyzed" marker.

Setup checklist

  1. Set MATTERMOST_BASE_URL in the Config node.
  2. Create an HTTP Header Auth credential called "Mattermost PAT" with:
  • Name: Authorization
  • Value: Bearer <your_personal_access_token>
  1. Attach this credential to all three HTTP Request nodes (Get file info, Download file, Download text file).
  2. Attach your OpenAI credential to the "OpenAI: Analyze Image" node.
  3. Tune in Config: VISION_MODEL, MAX_IMAGE_SIZE_BYTES, MAX_TEXT_SIZE_BYTES, MAX_TEXT_LINES.

Notes

  • The IF guard short-circuits when file_ids is empty so the parent workflow can call this subworkflow unconditionally.
  • Classification by mime + extension catches .log files served as application/octet-stream.
  • Final output is always a single item with the same shape — safe to consume in the parent.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - About

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 2 - When Executed by Another Workflow

Type / Role
n8n-nodes-base.executeWorkflowTrigger - executeWorkflowTrigger
Config choices
Version 1.1

Block 3 - Config

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 4 - Has attachments?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 5 - Empty result

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 6 - Split file_ids

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 7 - Get file info

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 8 - Classify file

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 9 - Route by category

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.2

Block 10 - Download file

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 11 - OpenAI: Analyze Image

Type / Role
@n8n/n8n-nodes-langchain.openAi - openAi
Config choices
Version 1.8

Block 12 - Format image description

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 13 - Download text file

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 14 - Format text content

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 15 - Text too large marker

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 16 - Non-image marker

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 17 - Merge

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 18 - Aggregate

Type / Role
n8n-nodes-base.aggregate - aggregate
Config choices
Version 1

Block 19 - Build attachments_context

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 20 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 21 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 22 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Analyze Mattermost attachments with OpenAI vision for AI agents
Complexity advanced
Nodes 22
Categories Document Extraction, AI Summarization
Author Sergei Byvshev
Published 11 May 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/15612/15612.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Analyze Mattermost attachments with OpenAI vision for AI agents do?

Overview Subworkflow for analyzing Mattermost attachments. Per attachment behavior Image (mime starts with , size ≤ ): downloaded and analyzed by OpenAI vision model. Text small (text like by mime/...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Document Extraction, AI Summarization use case.