workflows.fit
Back to n8n workflows
n8n templateFreeBy Sergei Byvshev

Analyze Mattermost attachments with OpenAI vision for AI agents

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

DevelopmentCore NodesAILangchainSticky NoteExecute Workflow TriggerSetIf
Loading interactive preview...

Template notes

Overview

Subworkflow for analyzing Mattermost attachments.

Per-attachment behavior - Image (mime starts with image/, size ≤ MAXIMAGESIZEBYTES): downloaded and analyzed by OpenAI vision model. - Text small (text-like by mime/extension, size ≤ MAXTEXTSIZEBYTES): downloaded as plain text and inlined into the context block (with line count check ≤ MAXTEXTLINES). - 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 MATTERMOSTBASEURL in the Config node. 2. Create an HTTP Header Auth credential called "Mattermost PAT" with: - Name: Authorization - Value: Bearer <yourpersonalaccesstoken> 3. Attach this credential to all three HTTP Request nodes (Get file info, Download file, Download text file). 4. Attach your OpenAI credential to the "OpenAI: Analyze Image" node. 5. Tune in Config: VISIONMODEL, MAXIMAGESIZEBYTES, MAXTEXTSIZEBYTES, MAXTEXTLINES.

Notes - The IF guard short-circuits when fileids 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.