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.