Skip to content

Instantly share code, notes, and snippets.

@rallisf1
Created May 24, 2026 10:22
Show Gist options
  • Select an option

  • Save rallisf1/3be5169bcc4f00f0ab32d7b5c4b57aef to your computer and use it in GitHub Desktop.

Select an option

Save rallisf1/3be5169bcc4f00f0ab32d7b5c4b57aef to your computer and use it in GitHub Desktop.
n8n workflow: Canva HTML to Notifuse MJML email template
{
"name": "file manager",
"nodes": [
{
"parameters": {
"operation": "upload",
"bucketName": "BUCKET_NAME",
"fileName": "={{ $('When Executed by Another Workflow').item.json.workspace_id }}/{{ $json.fileName }}",
"additionalFields": {}
},
"type": "n8n-nodes-base.s3",
"typeVersion": 1,
"position": [
496,
-352
],
"id": "0038e792-ddfe-40a1-b119-4efdaba2e65f",
"name": "Upload a file",
"notesInFlow": false,
"credentials": {
"s3": {
"id": "O8XCFDJFerregMyN",
"name": "Backblaze notifuse"
}
},
"notes": "the bucket must have file lock and versioning disabled!"
},
{
"parameters": {
"keepOnlySet": true,
"textsWithManipulations": {
"textsWithManipulationsValues": [
{
"dataSources": {
"dataSource": [
{
"text": "={{ $json.extractedText }}",
"destinationKey": "html"
}
]
},
"manipulations": {
"manipulation": [
{
"action": "replace",
"substring": "images/",
"value": "=https://CDN_DOMAIN/{{ $('When Executed by Another Workflow').item.json.workspace_id }}/"
}
]
}
}
]
}
},
"type": "n8n-nodes-text-manipulation.textManipulation",
"typeVersion": 1,
"position": [
720,
-224
],
"id": "2eb84315-389a-4fb0-a479-9f65a5e716fa",
"name": "TextManipulation"
},
{
"parameters": {
"jsCode": "const output = [];\n\nfor (const item of $input.all()) {\n for (const key of Object.keys(item.binary ?? {})) {\n output.push({\n json: {\n fileName: item.binary[key].fileName,\n mimeType: item.binary[key].mimeType,\n },\n binary: {\n data: item.binary[key],\n },\n });\n }\n}\n\nreturn output;"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
128,
-288
],
"id": "fcf45308-f80d-474b-bc5b-970050a7848e",
"name": "Split files"
},
{
"parameters": {
"binaryPropertyName": "zip"
},
"type": "n8n-nodes-base.compression",
"typeVersion": 1.1,
"position": [
-64,
-288
],
"id": "4b19a047-3e00-49df-8841-4158141323d5",
"name": "Unzip"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "6a51e94f-a80c-4c03-b23d-1224b70ddae7",
"leftValue": "={{ $json.fileName }}",
"rightValue": "/\\.(jpg|jpeg|png|webp|gif)$/i",
"operator": {
"type": "string",
"operation": "regex"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.filter",
"typeVersion": 2.3,
"position": [
320,
-352
],
"id": "c3d8a037-24d9-4fc7-9e01-b68d3446018a",
"name": "Only images"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "660e288a-bdb9-45bb-9ec2-58fb0f9b0b30",
"leftValue": "={{ $json.fileName }}",
"rightValue": "email.html",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.filter",
"typeVersion": 2.3,
"position": [
320,
-192
],
"id": "52219ef2-c352-482b-8402-2f68dfe1d91b",
"name": "Only HTML"
},
{
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "const buffer = await this.helpers.getBinaryDataBuffer(0, 'data');\n\nconst textContent = buffer.toString('utf8');\n\nreturn {\n json: {\n extractedText: textContent\n }\n};"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
496,
-192
],
"id": "168510de-1691-4788-863e-9a01a6988e52",
"name": "Binary to String"
},
{
"parameters": {
"method": "POST",
"url": "https://MJML_SERVICE_DOMAIN/html-to-mjml",
"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Accept",
"value": "application/json"
}
]
},
"sendBody": true,
"contentType": "raw",
"rawContentType": "text/html",
"body": "={{ $json.html }}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
976,
-368
],
"id": "4dd63e7f-9367-412c-a4ba-65769bf05364",
"name": "HTML to MJML (json)",
"credentials": {
"httpBearerAuth": {
"id": "kUfmRyBahC9GQdKN",
"name": "MJML API Key"
}
}
},
{
"parameters": {
"method": "POST",
"url": "https://MJML_SERVICE_DOMAIN/html-to-mjml",
"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Accept",
"value": "application/xml"
}
]
},
"sendBody": true,
"contentType": "raw",
"rawContentType": "text/html",
"body": "={{ $json.html }}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
976,
-224
],
"id": "49022acb-5979-4baf-991c-d6b093591bb6",
"name": "HTML to MJML (xml)",
"credentials": {
"httpBearerAuth": {
"id": "kUfmRyBahC9GQdKN",
"name": "MJML API Key"
}
}
},
{
"parameters": {
"inputSource": "passthrough"
},
"type": "n8n-nodes-base.executeWorkflowTrigger",
"typeVersion": 1.1,
"position": [
-256,
-288
],
"id": "d1b751a0-d2c4-457b-9102-3c2434afa21f",
"name": "When Executed by Another Workflow"
},
{
"parameters": {
"mode": "combine",
"combineBy": "combineAll",
"options": {}
},
"type": "n8n-nodes-base.merge",
"typeVersion": 3.2,
"position": [
1216,
-288
],
"id": "8115c493-4d49-40f1-a66b-1072d8347008",
"name": "Merge"
}
],
"pinData": {},
"connections": {
"TextManipulation": {
"main": [
[
{
"node": "HTML to MJML (json)",
"type": "main",
"index": 0
},
{
"node": "HTML to MJML (xml)",
"type": "main",
"index": 0
}
]
]
},
"Unzip": {
"main": [
[
{
"node": "Split files",
"type": "main",
"index": 0
}
]
]
},
"Split files": {
"main": [
[
{
"node": "Only images",
"type": "main",
"index": 0
},
{
"node": "Only HTML",
"type": "main",
"index": 0
}
]
]
},
"Only images": {
"main": [
[
{
"node": "Upload a file",
"type": "main",
"index": 0
}
]
]
},
"Only HTML": {
"main": [
[
{
"node": "Binary to String",
"type": "main",
"index": 0
}
]
]
},
"Binary to String": {
"main": [
[
{
"node": "TextManipulation",
"type": "main",
"index": 0
}
]
]
},
"HTML to MJML (xml)": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"When Executed by Another Workflow": {
"main": [
[
{
"node": "Unzip",
"type": "main",
"index": 0
}
]
]
},
"HTML to MJML (json)": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Merge": {
"main": [
[]
]
}
},
"active": true,
"settings": {
"executionOrder": "v1",
"binaryMode": "separate",
"timeSavedMode": "fixed",
"callerPolicy": "workflowsFromSameOwner",
"availableInMCP": false,
"saveDataSuccessExecution": "none"
},
"versionId": "42d3b597-93bc-4d9c-ad6a-b8894ded0329",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "f6882f9b6a2084bfd33b75784137e341e61c407b1a2cc95c37f43d032f1414a4"
},
"id": "YHo1opOPxowH9B9Z",
"tags": []
}
{
"name": "main",
"nodes": [
{
"parameters": {
"url": "https://NOTIFUSE_DOMAIN/api/templates.list",
"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "workspace_id",
"value": "={{ $('Set Constants').item.json.workspace_id }}"
},
{
"name": "channel",
"value": "email"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
720,
96
],
"id": "92bfda8e-66b2-4e41-9981-6b8c63f1e740",
"name": "Get Templates",
"credentials": {
"httpBearerAuth": {
"id": "2JeTsL3HCI31XLAw",
"name": "Notifuse API Key"
}
}
},
{
"parameters": {
"formTitle": "Canva HTML to Notifuse MJML Converter",
"formFields": {
"values": [
{
"fieldLabel": "Template File",
"fieldType": "file",
"requiredField": true
},
{
"fieldLabel": "Is this a new template or an existing one?",
"fieldType": "radio",
"defaultValue": "New Template",
"fieldOptions": {
"values": [
{
"option": "New Template"
},
{
"option": "Existing Template"
}
]
},
"requiredField": true
},
{
"fieldLabel": "Workspace",
"fieldType": "dropdown",
"fieldOptions": {
"values": [
{
"option": "my_first_workspace"
},
{
"option": "my_second_workspace"
}
]
},
"requiredField": true
}
]
},
"responseMode": "lastNode",
"options": {
"buttonLabel": "Continue"
}
},
"type": "n8n-nodes-base.formTrigger",
"typeVersion": 2.5,
"position": [
-64,
0
],
"id": "be7ae2e2-8fdf-417e-96e8-f76b05a118fc",
"name": "Upload template",
"webhookId": "e4b5473e-95f1-4a33-b46c-2044673f97d6"
},
{
"parameters": {
"formFields": {
"values": [
{
"fieldLabel": "Template Category",
"fieldType": "dropdown",
"defaultValue": "marketing",
"fieldOptions": {
"values": [
{
"option": "marketing"
},
{
"option": "transactional"
},
{
"option": "welcome"
},
{
"option": "opt_in"
},
{
"option": "unsubscribe"
},
{
"option": "bounce"
},
{
"option": "blocklist"
},
{
"option": "other"
}
]
},
"requiredField": true
},
{
"fieldLabel": "Subject",
"requiredField": true
},
{
"fieldLabel": "Preview",
"requiredField": true
}
]
},
"options": {}
},
"type": "n8n-nodes-base.form",
"typeVersion": 2.5,
"position": [
720,
-64
],
"id": "79988f20-3a60-45fb-8c13-e224b6760216",
"name": "New Template",
"webhookId": "edb7ae30-bba1-47a0-b1e4-93136936f9cc"
},
{
"parameters": {
"defineForm": "json",
"jsonOutput": "=[\n {\n \"fieldLabel\": \"Select Template\",\n \"fieldType\": \"dropdown\",\n \"fieldOptions\": {\n \"values\": {{ JSON.stringify($json.templates.map(t => { return { \"option\": t.id } } )) }}\n },\n \"requiredField\": true\n }\n]",
"options": {}
},
"type": "n8n-nodes-base.form",
"typeVersion": 2.5,
"position": [
928,
96
],
"id": "a43819bf-07ff-4e18-8c66-5748a15c037b",
"name": "Select Template",
"webhookId": "0e59f223-8605-454d-ba20-f8415d0d2745"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "4fccfda1-5bfd-4082-a80b-d5e274a904fd",
"leftValue": "={{ $('Set Constants').item.json.is_new }}",
"rightValue": "New Template",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
496,
0
],
"id": "4c695cff-9cd7-486d-8871-e441b117de26",
"name": "New or Existing Template ?"
},
{
"parameters": {
"method": "POST",
"url": "https://NOTIFUSE_DOMAIN/api/templates.create",
"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth",
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "workspace_id",
"value": "={{ $('Set Constants').item.json.workspace_id }}"
},
{
"name": "channel",
"value": "email"
},
{
"name": "name",
"value": "={{ $('Set Constants').item.json.template_name }}"
},
{
"name": "category",
"value": "={{ $('New Template').item.json['Template Category'] }}"
},
{
"name": "email",
"value": "={{ {\n \"subject\": $('New Template').item.json['Subject'],\n \"subject_preview\": $('New Template').item.json['Preview'],\n \"compiled_preview\": $('file workflow').item.json['data'],\n \"visual_editor_tree\": {\n \"id\": \"mjml-1\",\n \"type\": \"mjml\",\n \"attributes\": $('file workflow').item.json['attributes'],\n \"children\": $('file workflow').item.json['children']\n }\n} }}"
},
{
"name": "id",
"value": "={{ $('Set Constants').item.json.template_slug }}_{{ Date.now().toString() }}"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
928,
-64
],
"id": "62732541-73ae-4088-8869-711238893290",
"name": "Create Template",
"credentials": {
"httpBearerAuth": {
"id": "2JeTsL3HCI31XLAw",
"name": "Notifuse API Key"
}
}
},
{
"parameters": {
"workflowId": {
"__rl": true,
"value": "YHo1opOPxowH9B9Z",
"mode": "list",
"cachedResultUrl": "/workflow/YHo1opOPxowH9B9Z",
"cachedResultName": "file manager"
},
"workflowInputs": {
"mappingMode": "defineBelow",
"value": {},
"matchingColumns": [],
"schema": [],
"attemptToConvertTypes": false,
"convertFieldsToString": true
},
"options": {
"waitForSubWorkflow": true
}
},
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1.3,
"position": [
304,
0
],
"id": "b0883199-a0e6-4165-a81b-0fa48d4cc691",
"name": "file workflow"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "f97e62ae-9c1f-42b9-979e-91171a57ca15",
"name": "workspace_id",
"value": "={{ $json[\"Workspace\"] }}",
"type": "string"
},
{
"id": "953dc9e7-7ba5-4f74-96f1-eb725bf91597",
"name": "template_name",
"value": "={{ $json[\"Template File\"][0].filename.slice(0, -4) }}",
"type": "string"
},
{
"id": "195a3d45-b1c4-4a77-9f27-2c505f6446c0",
"name": "template_slug",
"value": "={{ $json[\"Template File\"][0].filename.slice(0, -4).normalize('NFD').replace(/[\\u0300-\\u036f]/g, '').toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/-+/g, '_').replace(/^-|-$/g, '') }}",
"type": "string"
},
{
"id": "faddb03b-1fae-4f78-b7d5-e2097de73fdc",
"name": "zip",
"value": "Template_File",
"type": "binary"
},
{
"id": "cc491297-b77e-4c58-b9f5-3ad44bbca3d9",
"name": "is_new",
"value": "={{ $json[\"Is this a new template or an existing one?\"] === 'New Template' }}",
"type": "boolean"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
128,
0
],
"id": "f5f99a6b-0254-4c31-9df1-f2f3f44b842e",
"name": "Set Constants"
},
{
"parameters": {
"method": "POST",
"url": "https://NOTIFUSE_DOMAIN/api/templates.update",
"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth",
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "workspace_id",
"value": "={{ $('Set Constants').item.json.workspace_id }}"
},
{
"name": "channel",
"value": "email"
},
{
"name": "name",
"value": "={{ $json.name }}"
},
{
"name": "category",
"value": "={{ $json.category }}"
},
{
"name": "email",
"value": "={{ $json.email }}"
},
{
"name": "id",
"value": "={{ $json.id }}"
},
{
"name": "version",
"value": "={{ $json.version }}"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
1328,
96
],
"id": "773adfc8-84c7-47c8-a1f0-5cb5702f753c",
"name": "Update Template",
"credentials": {
"httpBearerAuth": {
"id": "2JeTsL3HCI31XLAw",
"name": "Notifuse API Key"
}
}
},
{
"parameters": {
"jsCode": "const template = $('Get Templates').first().json.templates.filter(t => t.id === $input.first().json['Select Template'])[0];\n\ntemplate.version = template.version + 1;\ntemplate.email.compiled_preview = $('file workflow').first().json.data;\ntemplate.email.visual_editor_tree = {\n \"id\": \"mjml-1\",\n \"type\": \"mjml\",\n \"attributes\": $('file workflow').first().json.attributes,\n \"children\": $('file workflow').first().json.children\n}\n\nreturn {\n json: template\n}"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1136,
96
],
"id": "e5eef6a8-45b2-4aa2-9c03-a596e90aaff6",
"name": "Merge Template Data"
}
],
"pinData": {},
"connections": {
"Get Templates": {
"main": [
[
{
"node": "Select Template",
"type": "main",
"index": 0
}
]
]
},
"Upload template": {
"main": [
[
{
"node": "Set Constants",
"type": "main",
"index": 0
}
]
]
},
"New or Existing Template ?": {
"main": [
[
{
"node": "New Template",
"type": "main",
"index": 0
}
],
[
{
"node": "Get Templates",
"type": "main",
"index": 0
}
]
]
},
"New Template": {
"main": [
[
{
"node": "Create Template",
"type": "main",
"index": 0
}
]
]
},
"Select Template": {
"main": [
[
{
"node": "Merge Template Data",
"type": "main",
"index": 0
}
]
]
},
"file workflow": {
"main": [
[
{
"node": "New or Existing Template ?",
"type": "main",
"index": 0
}
]
]
},
"Set Constants": {
"main": [
[
{
"node": "file workflow",
"type": "main",
"index": 0
}
]
]
},
"Merge Template Data": {
"main": [
[
{
"node": "Update Template",
"type": "main",
"index": 0
}
]
]
}
},
"active": true,
"settings": {
"executionOrder": "v1",
"binaryMode": "separate",
"timeSavedMode": "fixed",
"saveDataSuccessExecution": "none",
"callerPolicy": "workflowsFromSameOwner",
"availableInMCP": false
},
"versionId": "03a203fb-988e-4de3-a12d-e8a7512cbc17",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "f6882f9b6a2084bfd33b75784137e341e61c407b1a2cc95c37f43d032f1414a4"
},
"id": "XMTPdq5f1Xl4BqGs",
"tags": []
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment