Zapier/Make to n8n Migration Kit
Module 23 · ship · advanced
created.js
// Attach the n8n API result to each scenario: created only if n8n returned a workflow id.
const rep = $('Build Report').first().json;
const results = $input.all().map((i) => i.json);
const scenarios = rep.scenarios.map((x, i) => {
const r = results[i] ?? {};
const ok = Boolean(r.id) && !r.error;
return { ...x, created: ok, created_id: ok ? r.id : null, create_error: ok ? null : String(r.error?.message ?? r.error ?? r.message ?? 'no workflow id returned (check the n8n API credential)').slice(0, 300) };
});
return [{ json: { ...rep, scenarios } }];