n8n WorkFlow File
text
{
"name": "My workflow 4",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "convert-to-pdf",
"responseMode": "responseNode",
"options": {}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
0,
16
],
"id": "1947de46-f862-4a81-9f7a-fccd4f618156",
"name": "Triggure From Software",
"webhookId": "ec379fde-76b7-49c6-a1c0-6a6a79d9b56e"
},
{
"parameters": {
"method": "POST",
"url": "http://gotenberg:3000/forms/chromium/convert/html",
"sendBody": true,
"contentType": "multipart-form-data",
"bodyParameters": {
"parameters": [
{
"parameterType": "formBinaryData",
"name": "files",
"inputDataFieldName": "data"
}
]
},
"options": {
"response": {
"response": {
"responseFormat": "file"
}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1120,
-224
],
"id": "576cf05d-5b06-470a-a9da-0f68bb4a6e04",
"name": "Convert to pdf by local GotenBerg"
},
{
"parameters": {
"content": "# Link internal software with proper PDF Generation via Gotenburg\n## https://www.linkedin.com/in/jahidhasan0/\n## Jahid Hasan",
"height": 800,
"width": 1684,
"color": 5
},
"type": "n8n-nodes-base.stickyNote",
"position": [
-122,
-432
],
"typeVersion": 1,
"id": "c7f01e01-8305-4889-923d-b0de47c48102",
"name": "Sticky Note"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "2a1d79da-30a4-456e-a2c5-4ef2d006dd08",
"name": "data",
"value": "={{ $json.body }}",
"type": "object"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
224,
16
],
"id": "79c51db1-39fc-4674-ba0b-8bc92c040e00",
"name": "Grab Datas"
},
{
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"leftValue": "={{ $json.data.document }}",
"rightValue": "Invoice",
"operator": {
"type": "string",
"operation": "equals"
},
"id": "b1ad8f71-f54a-4237-98b5-9caa3e78f57b"
}
],
"combinator": "and"
}
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "28dbba72-ceb7-42d5-8642-121c891ce19d",
"leftValue": "={{ $json.data.document }}",
"rightValue": "Quotation",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
}
}
]
},
"options": {
"fallbackOutput": "extra"
}
},
"type": "n8n-nodes-base.switch",
"typeVersion": 3.2,
"position": [
448,
0
],
"id": "a1faeb06-c555-4200-adf3-70178501310d",
"name": "Template Selection"
},
{
"parameters": {
"operation": "toText",
"sourceProperty": "data",
"options": {
"fileName": "index.html"
}
},
"type": "n8n-nodes-base.convertToFile",
"typeVersion": 1.1,
"position": [
896,
-224
],
"id": "eaa79a3a-1ecc-424c-b95d-3efc1dacc5dc",
"name": "Convert to BINARY"
},
{
"parameters": {
"respondWith": "noData",
"options": {
"responseCode": "={{ $json.error.status || 404 }}"
}
},
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.4,
"position": [
896,
-32
],
"id": "b5849d57-b091-48bd-856e-9fb537aac68e",
"name": "Handle PHP Errors"
},
{
"parameters": {
"method": "POST",
"url": "http://nginx/quotation.php",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ $json.data }}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
672,
16
],
"id": "6f7234fc-3a3c-4f5a-b3cf-6833b16a5fb5",
"name": "Quotation HTML from nginx",
"onError": "continueErrorOutput"
},
{
"parameters": {
"respondWith": "noData",
"options": {
"responseCode": "={{ $json.error.status || 404 }}"
}
},
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.4,
"position": [
672,
208
],
"id": "4c8ef998-9db7-4e29-962e-004a6cc41e1c",
"name": "Invalid Template Response"
},
{
"parameters": {
"respondWith": "binary",
"responseDataSource": "set",
"options": {}
},
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.4,
"position": [
1344,
-224
],
"id": "86a8e911-b5a6-4c9d-a214-e6a3b7e26c25",
"name": "Send PDF back"
},
{
"parameters": {
"method": "POST",
"url": "http://nginx/invoice.php",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ $json.data }}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
672,
-272
],
"id": "cfd47e35-f5dc-40c5-ae8c-881a819ff1f8",
"name": "Invoice HTML from nginx",
"onError": "continueErrorOutput"
}
],
"pinData": {},
"connections": {
"Triggure From Software": {
"main": [
[
{
"node": "Grab Datas",
"type": "main",
"index": 0
}
]
]
},
"Convert to pdf by local GotenBerg": {
"main": [
[
{
"node": "Send PDF back",
"type": "main",
"index": 0
}
]
]
},
"Grab Datas": {
"main": [
[
{
"node": "Template Selection",
"type": "main",
"index": 0
}
]
]
},
"Template Selection": {
"main": [
[
{
"node": "Invoice HTML from nginx",
"type": "main",
"index": 0
}
],
[
{
"node": "Quotation HTML from nginx",
"type": "main",
"index": 0
}
],
[
{
"node": "Invalid Template Response",
"type": "main",
"index": 0
}
]
]
},
"Convert to BINARY": {
"main": [
[
{
"node": "Convert to pdf by local GotenBerg",
"type": "main",
"index": 0
}
]
]
},
"Handle PHP Errors": {
"main": [
[]
]
},
"Quotation HTML from nginx": {
"main": [
[
{
"node": "Convert to BINARY",
"type": "main",
"index": 0
}
],
[
{
"node": "Handle PHP Errors",
"type": "main",
"index": 0
}
]
]
},
"Invoice HTML from nginx": {
"main": [
[
{
"node": "Convert to BINARY",
"type": "main",
"index": 0
}
],
[
{
"node": "Handle PHP Errors",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "c6032fb7-ef08-4383-b19b-b15a36119cee",
"meta": {
"instanceId": "a1b6dd0763ee925cc9d9966cd174b0e1b85cb8988bcb1ed4eb453c107d26e4ba"
},
"id": "ntKDR1h5bqRrtv1h",
"tags": []
}