n8n-backup/workflows/MyToys.json

499 lines
12 KiB
JSON

{
"active": true,
"connections": {
"Auftragsdaten CSV einlesen": {
"main": [
[
{
"node": "Set1",
"type": "main",
"index": 0
}
]
]
},
"FTP": {
"main": [
[
{
"node": "FTP1",
"type": "main",
"index": 0
}
]
]
},
"PDF": {
"main": [
[],
[
{
"node": "Auftragsdaten CSV einlesen",
"type": "main",
"index": 0
},
{
"node": "Ins Archiv verschieben",
"type": "main",
"index": 0
}
]
]
},
"FTP1": {
"main": [
[
{
"node": "PDF",
"type": "main",
"index": 0
}
]
]
},
"Execute Command": {
"main": [
[
{
"node": "Billbee ShopID + Token",
"type": "main",
"index": 0
}
]
]
},
"Set1": {
"main": [
[
{
"node": "Bestellung an Billbee senden",
"type": "main",
"index": 0
}
]
]
},
"Rückmeldung CSV erzeugen": {
"main": [
[
{
"node": "FTP2",
"type": "main",
"index": 0
}
]
]
},
"Webhook": {
"main": [
[
{
"node": "Code1",
"type": "main",
"index": 0
}
]
]
},
"Code1": {
"main": [
[
{
"node": "Rückmeldung CSV erzeugen",
"type": "main",
"index": 0
}
]
]
}
},
"createdAt": "2023-01-17T13:26:26.485Z",
"id": 1,
"name": "MyToys",
"nodes": [
{
"parameters": {
"protocol": "sftp",
"operation": "list",
"path": "/out"
},
"id": "77792d6c-723a-4021-a25b-866c87195fea",
"name": "FTP",
"type": "n8n-nodes-base.ftp",
"typeVersion": 1,
"position": [
400,
-180
],
"credentials": {
"sftp": {
"id": "1",
"name": "SFTP MyToys"
}
}
},
{
"parameters": {
"keepOnlySet": true,
"values": {
"string": [
{
"name": "BillbeeShopID",
"value": "97989"
},
{
"name": "X-Billbee-Api-Key",
"value": "={{$json[\"stdout\"]}}"
}
]
},
"options": {}
},
"id": "b9512729-4416-4712-a2fb-7aaa63af9f61",
"name": "Billbee ShopID + Token",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
380,
180
]
},
{
"parameters": {
"authentication": "basicAuth",
"requestMethod": "POST",
"url": "=https://app.billbee.io/api/v1/orders?shopId={{$node[\"Billbee ShopID + Token\"].parameter[\"values\"][\"string\"][0][\"value\"]}}",
"options": {},
"headerParametersUi": {
"parameter": [
{
"name": "={{$node[\"Billbee ShopID + Token\"].parameter[\"values\"][\"string\"][1][\"name\"]}}",
"value": "=2855BE2C-1D67-4AB0-9DEB-3073E6D27B1C"
}
]
}
},
"name": "Bestellung an Billbee senden",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [
1140,
180
],
"id": "c81d1331-8653-4693-ada1-6697dc9ee038",
"credentials": {
"httpBasicAuth": {
"id": "2",
"name": "Billbee"
}
}
},
{
"parameters": {
"operation": "toFile",
"fileFormat": "csv",
"options": {
"fileName": "=DESADV_ORD_{{$now}}.csv",
"headerRow": true
}
},
"id": "8ad49263-f0f0-4be8-84e3-7cee543e356b",
"name": "Rückmeldung CSV erzeugen",
"type": "n8n-nodes-base.spreadsheetFile",
"typeVersion": 1,
"position": [
1260,
620
]
},
{
"parameters": {
"binaryPropertyName": "=data",
"options": {
"headerRow": true
}
},
"id": "5de70737-ab1b-48e7-8fd7-3a722fbc00a9",
"name": "Auftragsdaten CSV einlesen",
"type": "n8n-nodes-base.spreadsheetFile",
"typeVersion": 1,
"position": [
1160,
-160
]
},
{
"parameters": {
"command": "cat $BILLBEE_API_KEY"
},
"id": "65c16259-a7d8-453a-a542-3d840328f396",
"name": "Execute Command",
"type": "n8n-nodes-base.executeCommand",
"typeVersion": 1,
"position": [
180,
180
]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$json[\"name\"]}}",
"operation": "endsWith",
"value2": "pdf"
}
]
}
},
"id": "d54af494-70dc-46ac-ad19-91c90fa53f69",
"name": "PDF",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
840,
-180
]
},
{
"parameters": {
"protocol": "sftp",
"path": "=/out/{{$json[\"name\"]}}"
},
"id": "ee40a4c2-d570-4a61-8373-e4e4c46536fd",
"name": "FTP1",
"type": "n8n-nodes-base.ftp",
"typeVersion": 1,
"position": [
620,
-180
],
"credentials": {
"sftp": {
"id": "1",
"name": "SFTP MyToys"
}
}
},
{
"parameters": {
"keepOnlySet": true,
"values": {
"string": [
{
"name": "CreatedAt",
"value": "={{ $today.toISODate()}}"
},
{
"name": "Ordernumber",
"value": "={{ $json[\"TB_ORDER_ID\"] }}"
},
{
"name": "invoiceAddress.Company",
"value": "={{ $json[\"CUST_SHIP_EXTENSION\"] }}"
},
{
"name": "invoiceAddress.Company",
"value": "={{ $json[\"CUST_SHIP_SURNAME\"] }}"
},
{
"name": "invoiceAddress.Street",
"value": "={{ $json[\"CUST_SHIP_STREET_NO\"] }}"
},
{
"name": "invoiceAddress.City",
"value": "={{ $json[\"CUST_SHIP_CITY\"] }}"
},
{
"name": "invoiceAddress.Zip",
"value": "={{$json[\"CUST_SHIP_ZIP\"]}}"
},
{
"name": "invoiceAddress.Country",
"value": "={{ $json[\"CUST_SHIP_COUNTRY_CODE\"] }}"
},
{
"name": "invoiceAddress.CountryISO2",
"value": "={{$json[\"CUST_SHIP_COUNTRY_CODE\"]}}"
},
{
"name": "invoiceAddress.FirstName",
"value": "={{$json[\"CUST_SHIP_FIRSTNAME\"]}}"
},
{
"name": "invoiceAddress.LastName",
"value": "={{$json[\"CUST_SHIP_FIRSTNAME\"]}}"
},
{
"name": "invoiceAddress.Email",
"value": "={{$json[\"CUST_SHIP_EMAIL\"]}}"
},
{
"name": "shippingAddress.Company",
"value": "={{ $json[\"CUST_SHIP_EXTENSION\"] }}"
},
{
"name": "shippingAddress.Company",
"value": "={{ $json[\"CUST_SHIP_SURNAME\"] }}"
},
{
"name": "shippingAddress.Street",
"value": "={{ $json[\"CUST_SHIP_STREET_NO\"] }}"
},
{
"name": "shippingAddress.City",
"value": "={{ $json[\"CUST_SHIP_CITY\"] }}"
},
{
"name": "shippingAddress.Zip",
"value": "={{$json[\"CUST_SHIP_ZIP\"]}}"
},
{
"name": "shippingAddress.Country",
"value": "={{ $json[\"CUST_SHIP_COUNTRY_CODE\"] }}"
},
{
"name": "shippingAddress.CountryISO2",
"value": "={{$json[\"CUST_SHIP_COUNTRY_CODE\"]}}"
},
{
"name": "shippingAddress.FirstName",
"value": "={{$json[\"CUST_SHIP_FIRSTNAME\"]}}"
},
{
"name": "shippingAddress.LastName",
"value": "={{$json[\"CUST_SHIP_FIRSTNAME\"]}}"
},
{
"name": "shippingAddress.Email",
"value": "={{$json[\"CUST_SHIP_EMAIL\"]}}"
},
{
"name": "=orderItems[0].product.SKU",
"value": "={{$json[\"POS_ANR\"]}}"
},
{
"name": "=orderItems[0].Quantity",
"value": "={{$json[\"POS_QUANTITY\"]}}"
},
{
"name": "=orderItems[0].TotalPrice",
"value": "={{$json[\"POS_SALESPRICE\"]}}"
},
{
"name": "Customer.Name",
"value": "MyToys Group"
},
{
"name": "Customer.Email",
"value": "dev@lanakk.com"
}
],
"number": [
{
"name": "PaymentMethod",
"value": "3"
},
{
"name": "Customer.Id",
"value": 163662708
},
{
"name": "Customer.Number",
"value": 20089
}
]
},
"options": {
"dotNotation": true
}
},
"id": "50b02a14-bac8-4748-be52-d2e789633254",
"name": "Set1",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
860,
180
]
},
{
"parameters": {
"protocol": "sftp",
"operation": "rename",
"oldPath": "={{$binary.data.directory}}/{{$binary.data.fileName}}",
"newPath": "=/archiv/{{$binary.data.fileName}}",
"options": {}
},
"id": "8e265faa-72f6-4d78-92f2-d946aa866f2f",
"name": "Ins Archiv verschieben",
"type": "n8n-nodes-base.ftp",
"typeVersion": 1,
"position": [
1160,
-360
],
"credentials": {
"sftp": {
"id": "1",
"name": "SFTP MyToys"
}
}
},
{
"parameters": {
"protocol": "sftp",
"operation": "upload",
"path": "=/in/{{$binary.data.fileName}}"
},
"id": "cd13302a-3bcf-4fdf-88a5-1ef5a40a725f",
"name": "FTP2",
"type": "n8n-nodes-base.ftp",
"typeVersion": 1,
"position": [
1620,
620
],
"credentials": {
"sftp": {
"id": "1",
"name": "SFTP MyToys"
}
}
},
{
"parameters": {
"path": "1730d70c-f532-4b6f-a20e-e2fc7edb2d45",
"options": {}
},
"id": "5a16780d-19a1-4967-8710-9225ddc59ddf",
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [
1660,
180
],
"webhookId": "1730d70c-f532-4b6f-a20e-e2fc7edb2d45"
},
{
"parameters": {
"jsCode": "let lines = [];\n\nfor (const item of $input.all()) {\n let parcel_type;\n switch(item.json.query.id) {\n case \"Eurocourier\":\n parcel_type = \"EC_STD_NATIONAL\";\n break;\n case \"GLS\":\n parcel_type = \"GLS_STD_NATIONAL\";\n break;\n default:\n parcel_type = \"DPD_STD_NATIONAL\";\n}\n let line = {\n \"TB_ORDER_ID\": item.json.query.id,\n \"ORDER_PAID\" : 0,\n \"TYPE\" : item.json.query.type,\n \"PARCEL_TYPE\": parcel_type,\n \"SHIP_CODE\" : item.json.query.shipment,\n \"COMMENT_INTERN\" : \"\",\n \"COMMENT\" : \"\",\n }; \n lines.push(line);\n}\n\nreturn lines;"
},
"id": "3f76d0dd-3525-4cdb-baab-e2205621ec39",
"name": "Code1",
"type": "n8n-nodes-base.code",
"typeVersion": 1,
"position": [
1880,
180
]
}
],
"pinData": {},
"settings": {},
"staticData": null,
"tags": [],
"updatedAt": "2023-01-20T15:51:45.866Z"
}