{
  "updatedAt": "2025-09-18T21:08:55.000Z",
  "createdAt": "2025-09-15T21:57:17.732Z",
  "id": "bO02jFwiu3Q6NcbB",
  "name": "FIX FOR MISSING DS24 Booksales -> Katrin sheet",
  "active": false,
  "isArchived": true,
  "nodes": [
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "1CjimHlsXSjtOoxUjn_a_u45Y6xgEqbVn3aHq8wXq6NE",
          "mode": "list",
          "cachedResultName": "Katrin Buchk\u00e4ufer mit Telefon bis 10.8.2024",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1CjimHlsXSjtOoxUjn_a_u45Y6xgEqbVn3aHq8wXq6NE/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 1696979597,
          "mode": "list",
          "cachedResultName": "export (1)",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1CjimHlsXSjtOoxUjn_a_u45Y6xgEqbVn3aHq8wXq6NE/edit#gid=1696979597"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Datum": "={{ $json.Date }}",
            "Zeit": "={{ $json.Time }}",
            "Produkt": "={{ $json[\"Product name\"] }}",
            "Anrede": "={{ $json.Title }}",
            "Nachname": "={{ $json[\"Last name\"] }}",
            "Vorname": "={{ $json[\"First name\"] }}",
            "E-Mail": "={{ $json.Email }}",
            "Telefonnr.": "={{ $json.Phone }}",
            "Land": "={{ $json.Country }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "Datum",
              "displayName": "Datum",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Zeit",
              "displayName": "Zeit",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Produkt",
              "displayName": "Produkt",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Anrede",
              "displayName": "Anrede",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Nachname",
              "displayName": "Nachname",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Vorname",
              "displayName": "Vorname",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "E-Mail",
              "displayName": "E-Mail",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Telefonnr.",
              "displayName": "Telefonnr.",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Land",
              "displayName": "Land",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Katrin Anmerkung",
              "displayName": "Katrin Anmerkung",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Adresse",
              "displayName": "Adresse",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "4,95",
              "displayName": "4,95",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "6,95",
              "displayName": "6,95",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.6,
      "position": [
        1344,
        560
      ],
      "id": "0e1663e1-e85d-475e-a455-4e408fddb4e5",
      "name": "Add Row to Google Sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "person",
        "name": "={{ $json.Vorname }} {{ $json.Nachname }} {{ $json.Adresse }}{{ $json.Land }} {{ $json.Datum }}",
        "additionalFields": {
          "email": [
            "={{ $json[\"E-Mail\"] }} "
          ],
          "phone": [
            "={{ $json[\"Telefonnr.\"] }} "
          ]
        }
      },
      "type": "n8n-nodes-base.pipedrive",
      "typeVersion": 1,
      "position": [
        176,
        976
      ],
      "id": "0f6e28be-948b-41e5-acbe-5e9df8a5dc07",
      "name": "Create a person",
      "credentials": {
        "pipedriveApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "note",
        "content": "={{ $json.name }} {{ $json.phone.first().value }} {{ $json.email.first().value }} {{ $('Code').item.json.Adresse  }}{{ $('Code').item.json.Land }}",
        "additionalFields": {
          "person_id": "={{ $json.id }}"
        }
      },
      "type": "n8n-nodes-base.pipedrive",
      "typeVersion": 1,
      "position": [
        1344,
        976
      ],
      "id": "258267e3-e5af-48b5-a530-10999a550fb7",
      "name": "Create a note",
      "credentials": {
        "pipedriveApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "content": "## Pipedrive - add person and create note",
        "height": 368,
        "width": 1232
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        64,
        848
      ],
      "id": "d02f4ec2-4aea-4bec-a556-bfce718b05d3",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "content": "## Digistore - order received\n",
        "height": 384,
        "width": 368,
        "color": 5
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -256,
        448
      ],
      "id": "13eaac83-138f-42a1-9ecc-c53d7990e6c4",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "content": "## Append Row in Google Sheet If not exists\n\nCheck google sheet for match on email address, product , and todays date",
        "height": 384,
        "width": 1168,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        128,
        448
      ],
      "id": "bc5d3500-7b62-4bbc-993f-a5c35d079a29",
      "name": "Sticky Note2"
    },
    {
      "parameters": {
        "content": "## DS24 Booksales -> Katrin sheet\n- Triggers on a Digistore sale\n- Logs order details (name, email, phone, address, etc.) to a Google Sheet used by the team\n- Creates a person in Pipedrive, and attaches a custom note to their profile with full contact info",
        "height": 272,
        "width": 1552,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -256,
        -176
      ],
      "id": "0068ea32-842f-4fd8-a928-6926c25f371f",
      "name": "Sticky Note3"
    },
    {
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "return  $input.item;\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -160,
        976
      ],
      "id": "bf091900-37db-471d-85c9-fa964a7a4c3e",
      "name": "Code"
    },
    {
      "parameters": {
        "content": "## Pre-process\nMake sure data values aren't empty",
        "height": 368,
        "width": 304,
        "color": 3
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -256,
        848
      ],
      "id": "d3159f4e-9bf3-4671-91e7-ffe098fa616f",
      "name": "Sticky Note4"
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        -192,
        208
      ],
      "id": "48f33a4a-573c-4cf1-b4f9-55fbea257672",
      "name": "Schedule Trigger"
    },
    {
      "parameters": {
        "fieldToSplitOut": "data.purchase_list",
        "options": {}
      },
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [
        256,
        208
      ],
      "id": "66c7aced-0ac5-4074-babc-44024d0b8840",
      "name": "Split Out",
      "alwaysOutputData": true
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "853c0ad4-7be0-4611-b40d-d26060e52471",
              "leftValue": "={{ $json.main_product_name }}",
              "rightValue": "(GRATIS BUCH) Die gr\u00f6\u00dften Gefahren f\u00fcr Ihr Verm\u00f6gen",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            },
            {
              "id": "3c216885-e310-41d8-99a2-334fd5f57463",
              "leftValue": "={{ $json.main_product_name }}",
              "rightValue": "(H\u00d6RBUCH UPSELL) Die gr\u00f6\u00dften Gefahren f\u00fcr Ihr Verm\u00f6gen",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            },
            {
              "id": "4271f59d-7b0b-48ad-9a5b-54d8c76148ce",
              "leftValue": "={{ $json.main_product_name }}",
              "rightValue": "(H\u00d6RBUCH) Die gr\u00f6\u00dften Gefahren f\u00fcr Ihr Verm\u00f6gen",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            },
            {
              "id": "719d8ae8-e68b-4b26-856f-498d21e4b258",
              "leftValue": "={{ $json.main_product_name }}",
              "rightValue": "BUCH (\u20ac19,90): Die gr\u00f6\u00dften Gefahren f\u00fcr Ihr Verm\u00f6gen",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            },
            {
              "id": "a6f2e684-c928-463c-809d-cee009afc0fc",
              "leftValue": "={{ $json.main_product_name }}",
              "rightValue": "BUCH (\u20ac3,99): Die gr\u00f6\u00dften Gefahren f\u00fcr Ihr Verm\u00f6gen",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            },
            {
              "id": "683d392d-1f7d-4a74-b890-b680588fb084",
              "leftValue": "={{ $json.main_product_name }}",
              "rightValue": "Insider-Interview Stiftungen (Upsell)",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "or"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.2,
      "position": [
        480,
        208
      ],
      "id": "bc624c72-1e63-4cf1-ad44-556ef3136f67",
      "name": "Filter"
    },
    {
      "parameters": {
        "url": "=https://www.digistore24.com/api/call/getBuyer?buyer_id={{ $json.buyer_id}}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        688,
        272
      ],
      "id": "7a0b73a4-e922-4ecd-ab41-992909debbae",
      "name": "Get Buyer Data",
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "mode": "combine",
        "advanced": true,
        "mergeByFields": {
          "values": [
            {
              "field1": "buyer.id",
              "field2": "data.buyer.id"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "position": [
        896,
        224
      ],
      "id": "d5f156ae-c88c-45c0-b3c4-3b7577433c58",
      "name": "Merge"
    },
    {
      "parameters": {
        "url": "https://www.digistore24.com/api/call/listPurchases?from=-1h&to=now",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        32,
        208
      ],
      "id": "58b46fc4-e344-43b3-a3f4-23ef0433212f",
      "name": "Get DS24 Orders",
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "content": "## Load DS24 Orders from API\nPoll every hour for all orders from -1h ago to now. Filter only those products in Buchfunnel group, get buyer data, format same as Digistore IPN fields",
        "height": 320,
        "width": 1552
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -256,
        112
      ],
      "id": "2763fedf-a306-4842-b307-963445c9ddc7",
      "name": "Sticky Note5"
    },
    {
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "return {\nemail: $json.buyer.email,\nfirst_name: $json.buyer.first_name,\nlast_name: $json.buyer.last_name,\ntitle: $json.data.buyer.title,\nsalutation: $json.data.buyer.salutation,\ncompany: $json.data.buyer.company,\nstreet: $json.data.buyer.street,\ncity: '',\nzipcode: $json.data.buyer.zipcode,\nstate: $json.data.buyer.state,\ncountry_code: $json.data.buyer.country,\ncountry_name: '',\nphone_no: $json.data.buyer.phone_no,\nbuyer_id: $json.buyer_id,\norder_id: $json.id,\ntransaction_id: \"\",\nproduct_name: $json.main_product_name,\nproduct_name_intern: $json.items[0].product_name_intern,\nproduct_id: $json.main_product_id,\nquantity: $json.items[0].quantity,\nreceipt_url: $json.receipt_url,\ninvoice_url: $json.invoice_url,\neticket_url: \"\",\ncustom: \"\",\ntags: \"\",\nevent: \"\",\namount_brutto: $json.amount,\namount_netto: $json.amount,\namount_vendor: $json.amount,\namount_affiliate: $json.affiliate_amount,\ncurrency: $json.currency,\nis_gdpr_country: \"\"\n}"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1120,
        224
      ],
      "id": "bc8a95c3-5041-4a3b-b153-6c710bac2d2f",
      "name": "Code1"
    },
    {
      "parameters": {
        "resource": "person",
        "operation": "get",
        "personId": "={{ $json.id }}"
      },
      "type": "n8n-nodes-base.pipedrive",
      "typeVersion": 1,
      "position": [
        832,
        976
      ],
      "id": "a91e6964-3cb9-45f5-ae90-c5e348b605c3",
      "name": "Get a person",
      "credentials": {
        "pipedriveApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1CjimHlsXSjtOoxUjn_a_u45Y6xgEqbVn3aHq8wXq6NE",
          "mode": "list",
          "cachedResultName": "Katrin Buchk\u00e4ufer mit Telefon bis 10.8.2024",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1CjimHlsXSjtOoxUjn_a_u45Y6xgEqbVn3aHq8wXq6NE/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 1696979597,
          "mode": "list",
          "cachedResultName": "export (1)",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1CjimHlsXSjtOoxUjn_a_u45Y6xgEqbVn3aHq8wXq6NE/edit#gid=1696979597"
        },
        "filtersUI": {
          "values": [
            {
              "lookupColumn": "=E-Mail",
              "lookupValue": "={{ $json.Email }}"
            },
            {
              "lookupColumn": "Produkt",
              "lookupValue": "={{ $json[\"Product name\"] }}"
            },
            {
              "lookupColumn": "Datum",
              "lookupValue": "={{ $now.format('y-MM-dd')}}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.6,
      "position": [
        528,
        576
      ],
      "id": "dfa04f81-982f-4007-b7c2-41da0edbe070",
      "name": "Get row(s) in sheet",
      "alwaysOutputData": true,
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// Get all items coming from previous node\nlet items = $('Extract from File').all();\n\n// Sort by the \"Date\" field (MM/DD/YYYY format)\nitems.sort((a, b) => {\n  const dateA = new Date(a.json.Date);\n  const dateB = new Date(b.json.Date);\n  return dateA - dateB; // ascending order\n});\n\n// Return the sorted items\nreturn items;\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1104,
        496
      ],
      "id": "36ca9fb9-6b10-4472-99da-f6346571f890",
      "name": "Code2"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "2bca5c6f-92a6-41d0-8dbe-c2b3af748aa4",
              "leftValue": "={{  $json }}",
              "rightValue": 0,
              "operator": {
                "type": "object",
                "operation": "empty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "looseTypeValidation": true,
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        832,
        576
      ],
      "id": "81a26e68-c4c7-4991-8e2e-12a0eda7c2d9",
      "name": "If No Result",
      "alwaysOutputData": true
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        1104,
        672
      ],
      "id": "cb1a4988-88c0-4585-b4c2-6027b59b9b40",
      "name": "No Operation, do nothing"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -192,
        576
      ],
      "id": "ad586467-535c-4fcd-82a7-f5c638b9c9d8",
      "name": "When clicking \u2018Execute workflow\u2019"
    },
    {
      "parameters": {
        "fileSelector": "/files/sales-sep10.csv",
        "options": {}
      },
      "type": "n8n-nodes-base.readWriteFile",
      "typeVersion": 1,
      "position": [
        16,
        576
      ],
      "id": "ec775344-6451-4b50-aa53-2c8b3e998f25",
      "name": "Read/Write Files from Disk"
    },
    {
      "parameters": {
        "options": {
          "encoding": "utf8",
          "enableBOM": false,
          "relaxQuotes": false,
          "rawData": false,
          "readAsString": false
        }
      },
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1,
      "position": [
        208,
        576
      ],
      "id": "6669b949-f409-4615-8d81-4bed056023b4",
      "name": "Extract from File"
    }
  ],
  "connections": {
    "Add Row to Google Sheet": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a person": {
      "main": [
        [
          {
            "node": "Get a person",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "Create a person",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get DS24 Orders",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter": {
      "main": [
        [
          {
            "node": "Get Buyer Data",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Buyer Data": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Code1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get DS24 Orders": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code1": {
      "main": [
        []
      ]
    },
    "Get a person": {
      "main": [
        [
          {
            "node": "Create a note",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet": {
      "main": [
        [
          {
            "node": "If No Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code2": {
      "main": [
        [
          {
            "node": "Add Row to Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If No Result": {
      "main": [
        [
          {
            "node": "Code2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Read/Write Files from Disk",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read/Write Files from Disk": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": "WbISMAIlclQfzorG"
  },
  "staticData": {
    "node:Schedule Trigger": {
      "recurrenceRules": []
    }
  },
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "versionId": "4486b6c4-5a0d-4f68-90b3-69b68d1a3ba8",
  "activeVersionId": null,
  "triggerCount": 2,
  "shared": [
    {
      "updatedAt": "2025-09-15T21:57:17.741Z",
      "createdAt": "2025-09-15T21:57:17.741Z",
      "role": "workflow:owner",
      "workflowId": "bO02jFwiu3Q6NcbB",
      "projectId": "B7QJE85HA2Vij1it"
    }
  ],
  "activeVersion": null,
  "tags": []
}