feat(po): include additional_attachments in send-email webhook
This commit is contained in:
parent
3c32c01bb9
commit
2b3b50596c
1 changed files with 15 additions and 0 deletions
|
|
@ -146,6 +146,17 @@ export async function POST(
|
|||
const supplierName =
|
||||
result.purchaseOrder.expand?.supplier?.suppliername || "";
|
||||
|
||||
// Additional files (supplier quote, drawing, NDA) the operator
|
||||
// wants to send with this PO. Sits alongside `documents` (the
|
||||
// versioned PDF). The n8n workflow reads this array and attaches
|
||||
// each token to the outbound SMTP message via the PB file proxy.
|
||||
const additionalRaw = result.purchaseOrder.additional_attachments ?? [];
|
||||
const additionalAttachments = Array.isArray(additionalRaw)
|
||||
? additionalRaw
|
||||
: additionalRaw
|
||||
? [additionalRaw]
|
||||
: [];
|
||||
|
||||
const webhookBody = {
|
||||
trigger: "manual_send",
|
||||
poId,
|
||||
|
|
@ -186,6 +197,10 @@ export async function POST(
|
|||
},
|
||||
]
|
||||
: [],
|
||||
// string[] of PB-stored tokens. The n8n workflow fetches each
|
||||
// file via the PB file proxy and attaches it to the outbound
|
||||
// SMTP message alongside `attachments` (the versioned PO PDF).
|
||||
additional_attachments: additionalAttachments,
|
||||
// PB admin token + URL, used by the workflow's HTTP Request node
|
||||
// to fetch the PDF directly from PB (Bearer-equivalent). PB
|
||||
// accepts the admin token in either `Authorization: <token>` or
|
||||
|
|
|
|||
Loading…
Reference in a new issue