Skip to main content
Question

n8n + Front API: How to enforce the order of multiple attachments in a draft? (Also: how to work with message templates + predefined attachments?)

  • December 9, 2025
  • 1 reply
  • 56 views

emre

Hi everyone,

I'm building an automation using n8n together with the Front API, and I'm running into a major challenge regarding attachment ordering inside a Front draft. I would really appreciate deeper clarification from the community or the Front team, because this is critical for my use case.

Context
I'm a service provider and we onboard customers into different training programs. Each onboarding email contains multiple PDF attachments in a fixed order.

From these files:

  • 6 documents are always the same and are already included inside a Front Message Template

  • 3 documents are unique per customer (contract, schedule, and one additional document), and these three files are generated dynamically in n8n and added to the draft in the same step after the template content is applied

Because of this setup, I rely on a Front template for the 6 standard documents, and n8n is responsible for attaching the remaining 3 customer-specific PDFs.

Problem: There is no way to create a draft from a template via n8n
I discovered that:

  • Front templates can be created manually in the Front UI

  • Front templates can be fetched via the API (GET /message_templates)

  • But I could not find any endpoint that allows me to instantiate a template into a draft programmatically

Unless I'm misunderstanding something, it appears that the Front API does not currently support creating a draft directly from an existing message template. Because of this, I must manually rebuild the draft body in n8n and manually attach all files instead of relying on the template’s built-in content and attachments.

Since the template already provides 6 of the standard documents, being able to create a draft from that template via API would simplify the automation significantly.

If Front does support template-based draft creation via API, I would appreciate guidance.

Main Issue: Attachment order is not deterministic
I have tried two attachment strategies:

A) Upload all attachments in one PATCH request (multipart/form-data)
Even though I send all attachments in the exact desired order, the final order shown in the Front UI is not consistent. Sometimes they appear reordered, but I cannot identify the sorting logic.

B) Multiple PATCH calls — always resending the full list
Since PATCH replaces attachments rather than appending, I attempted:

PATCH 1 → attachments = [file1]
PATCH 2 → attachments = [file1, file2]
PATCH 3 → attachments = [file1, file2, file3]

PATCH 9 → full list of 9 in the desired order

Even with this method, Front sometimes displays attachments in a different order than the order sent to the API.

What I need to know

  1. Does the Front API guarantee that attachment order will be preserved?
    If yes:

    • In which order?

    • The order they appear inside the multipart request?

    • Or does Front reorder attachments internally?

  2. Is there a recommended method to reliably enforce attachment ordering?
    For example: adding filename prefixes such as 01_, 02_, etc. → It did not work for me

  3. Is there a supported way to instantiate a message template via the API?
    Since the template already contains 6 predefined attachments, being able to use it directly would make the automation far easier.

  4. If the API is not designed to maintain a fixed order, what does Front consider best practice for achieving predictable attachment ordering?

Any clarification or recommendations would be greatly appreciated.

1 reply

justin
Forum|alt.badge.img+8
  • Fronteer
  • December 9, 2025

Hi ​@emre

Happy to help provide some additional insight into your questions:

Creating Drafts from Message Templates


The API doesn't support creating a draft directly from a message template. There's no endpoint that accepts a template_id to instantiate a template.
 
Workaround:
  1. Fetch the template: GET /message_templates/{template_id}
  1. Extract body, subject, and attachments from the response
  1. Create the draft: POST /channels/{channel_id}/drafts with that content
You'll need to rebuild the draft content in n8n from the template data.
 

Attachment Ordering

The public API doesn't guarantee that attachment order matches your request.
 

How it works:
  • Attachments are sorted by when Front processes and links them to the draft
  • The order in your multipart request doesn't determine the final order
  • Processing order may differ from the request order, so the final order isn't deterministic
What this means:
  • You can't reliably control attachment order via the public API
  • Filename prefixes (e.g., 01_, 02_) don't affect ordering
  • The order in the multipart form data doesn't guarantee the final order

Hopefully this helps provide some insight into what’s currently possible and not possible via the API. Let us know if there are any additional questions!