Using Attachment Nodes

Download the bytes of an email attachment and pass them to the next node.

Overview

The Attachment node fetches the actual file from an email attachment when your workflow reaches it. A Mailhook trigger gives downstream nodes only attachment details (id, filename, content type), which keeps the trigger fast. The Attachment node downloads the files you actually need and hands them on as Base64 content, ready for a Send Email attachment or a Knowledge document input.

The node only works in a workflow started by a Mailhook trigger, because it reads the triggering email. The designer will not save a workflow that has an Attachment node without a Mailhook trigger.

Configuration

  1. Drop an Attachment node onto the canvas, after a Mailhook trigger.
  2. Choose a Mode: Single returns the first matching file, Multiple returns every match.
  3. Set one or more Filters to pick which attachments you want. Leave them empty to take everything.
  4. Optionally turn on Fail if no attachment matches.
  5. Set an Output variable so later nodes can reference the result.

Configuration Reference

  • Mode - Single outputs one object; Multiple outputs a list with count and totalBytes.
  • Content type - filter by MIME type. Comma separated, wildcards allowed, for example application/pdf, image/*.
  • Filename pattern - filter by a filename glob, for example *.pdf.
  • Attachment ID - select one exact attachment, for example {{ input.attachments[0].id }}. When set, the other filters are ignored.
  • Min / Max size - filter by file size in bytes.
  • Fail if no attachment matches - off by default, so the step produces no output and the run continues; on means the step fails.
  • Email ID (Advanced) - leave blank to use the email that triggered the run.

Output

In Single mode the output is one object with filename, contentType, size, and content (the file, Base64 encoded). With an output variable of attachment, reference the file as {{ attachment.content }} and the name as {{ attachment.filename }}.

In Multiple mode the output is a list under attachments, plus a count and totalBytes. Loop over {{ attachment.attachments }} to process each one.

Usage Examples

  • File an invoice - filter on application/pdf in Single mode, then feed {{ attachment.content }} into a Knowledge node's document input.
  • Forward every image - use Multiple mode with content type image/*, then a Loop node that attaches each content to a Send Email node.

Tips

  • To feed a Send Email attachment, set the attachment filename to {{ attachment.filename }} and the content to {{ attachment.content }}.
  • Use a Condition node on the result to branch when no file matched in Single mode.
  • Filters combine, so a content type of application/pdf together with a filename pattern of invoice-* matches only invoice PDFs.

Common Pitfalls

  • Each file has a size cap (10 MB by default) and there is a total cap per run (25 MB by default). Larger files or totals fail with a clear error.
  • Received emails are kept for 30 days. Re-running a much older execution can fail because the attachment link has expired.
  • An Attachment node without a Mailhook trigger will not save. Add the trigger first.

Related Articles

Learn More

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.