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 Set MATTERMOST_BASE_URL in the Config node. Create an HTTP Header Auth credential called "Mattermost PAT" with: Name: Authorization Value: Bearer <your_personal_access_token> Attach this credential to all three HTTP Request nodes (Get file info, Download file, Download text file). Attach your OpenAI credential to the "OpenAI: Analyze Image" node. 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.
Related Templates
Text automations using Apple Shortcuts
Overview This workflow answers user requests sent via Mac Shortcuts Several Shortcuts call the same webhook, with a quer...
AI SEO Readability Audit: Check Website Friendliness for LLMs
Who is this for? This workflow is designed for SEO specialists, content creators, marketers, and website developers who ...
Reply to Outlook Emails with OpenAI
Who is this template for? This template is for any Microsoft Outlook user who wants a trained AI agent to reason and rep...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments