{
  "updatedAt": "2025-11-16T19:24:55.000Z",
  "createdAt": "2025-07-24T15:53:06.520Z",
  "id": "hif0lubhZ1LbCVDX",
  "name": "DS24 Booksales -> Katrin sheet",
  "active": true,
  "isArchived": false,
  "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": "={{ $now.format('yyyy-MM-dd') }}",
            "Zeit": "={{ $now.format('HH:mm') }}",
            "Produkt": "={{$json.product_name  }}",
            "Anrede": "={{  $json.salutation}}",
            "Nachname": "={{ $json.last_name }}",
            "Vorname": "={{ $json.first_name }}",
            "E-Mail": "={{ $json.email }}",
            "Telefonnr.": "='{{ $json.phone_no }}",
            "Land": "={{ $json.country_code }}",
            "Adresse": "={{ $json.street }}{{ $json.city }},{{ $json.state }}{{ $json.zipcode }}"
          },
          "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
            },
            {
              "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": [
        -176,
        576
      ],
      "id": "1e0b6dd4-5b2a-41dc-936a-41addeea0b9e",
      "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": [
        512,
        576
      ],
      "id": "4da67e90-d5b6-42e9-b32a-cf4c0cae2b25",
      "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": [
        1104,
        576
      ],
      "id": "9c29cb0b-d0cf-4c38-9d68-4806340810e2",
      "name": "Create a note",
      "credentials": {
        "pipedriveApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "content": "## Pipedrive - add person and create note",
        "height": 336,
        "width": 848,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        448,
        448
      ],
      "id": "50cc86d5-b061-4c83-87c9-6c8c4c80b9f8",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "content": "## Append Row in Google Sheet ",
        "height": 336,
        "width": 304,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -256,
        448
      ],
      "id": "40606dab-319e-481b-89bd-c0b8b8c4a0d6",
      "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": "9de6021f-c465-4952-bf96-a2c13f4f0084",
      "name": "Sticky Note3"
    },
    {
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "return  $input.item;\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        192,
        576
      ],
      "id": "d59f0ce4-6ce3-4595-9321-6bdcc82b9ac0",
      "name": "Code"
    },
    {
      "parameters": {
        "content": "## Pre-process\nMake sure data values aren't empty",
        "height": 336,
        "width": 368,
        "color": 3
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        64,
        448
      ],
      "id": "7f12a6fd-1486-43a1-9f25-b198258a7bba",
      "name": "Sticky Note4"
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        -192,
        208
      ],
      "id": "74751ab3-e7f8-42ca-bef7-c9ff78209ada",
      "name": "Schedule Trigger"
    },
    {
      "parameters": {
        "fieldToSplitOut": "data.purchase_list",
        "options": {}
      },
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [
        256,
        208
      ],
      "id": "ac0244ca-1b18-4adc-b9ea-b5bdcecb5f98",
      "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": "95f05ba8-ac53-44a2-939f-93fa51d400ea",
      "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": "97a5cf75-46ab-4d5b-97b0-29a351d2b5ea",
      "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": "5f44772a-5ebb-4678-8dfc-43ff9f225a94",
      "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": "f4f4238d-d07a-4415-89fc-9321735ccb74",
      "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": "242f79b8-7be3-4daa-aa6b-e60caa8c254e",
      "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": "e339e06a-bbfa-4fac-962c-17dd473c78c4",
      "name": "Code1"
    },
    {
      "parameters": {
        "resource": "person",
        "operation": "get",
        "personId": "={{ $json.id }}"
      },
      "type": "n8n-nodes-base.pipedrive",
      "typeVersion": 1,
      "position": [
        800,
        576
      ],
      "id": "25fca0db-d792-4717-ac66-af80111e9dfe",
      "name": "Get a person",
      "credentials": {
        "pipedriveApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "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": [
        [
          {
            "node": "Add Row to Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get a person": {
      "main": [
        [
          {
            "node": "Create a note",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": "WbISMAIlclQfzorG"
  },
  "staticData": {
    "node:Schedule Trigger": {
      "recurrenceRules": []
    }
  },
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "versionId": "fd286ba0-e128-439a-afef-51dc300c50fc",
  "activeVersionId": "fd286ba0-e128-439a-afef-51dc300c50fc",
  "triggerCount": 1,
  "shared": [
    {
      "updatedAt": "2025-07-24T15:53:06.537Z",
      "createdAt": "2025-07-24T15:53:06.537Z",
      "role": "workflow:owner",
      "workflowId": "hif0lubhZ1LbCVDX",
      "projectId": "B7QJE85HA2Vij1it"
    }
  ],
  "activeVersion": {
    "updatedAt": "2025-11-26T20:39:59.471Z",
    "createdAt": "2025-11-26T20:39:59.471Z",
    "versionId": "fd286ba0-e128-439a-afef-51dc300c50fc",
    "workflowId": "hif0lubhZ1LbCVDX",
    "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": "={{ $now.format('yyyy-MM-dd') }}",
              "Zeit": "={{ $now.format('HH:mm') }}",
              "Produkt": "={{$json.product_name  }}",
              "Anrede": "={{  $json.salutation}}",
              "Nachname": "={{ $json.last_name }}",
              "Vorname": "={{ $json.first_name }}",
              "E-Mail": "={{ $json.email }}",
              "Telefonnr.": "='{{ $json.phone_no }}",
              "Land": "={{ $json.country_code }}",
              "Adresse": "={{ $json.street }}{{ $json.city }},{{ $json.state }}{{ $json.zipcode }}"
            },
            "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
              },
              {
                "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": [
          -176,
          576
        ],
        "id": "1e0b6dd4-5b2a-41dc-936a-41addeea0b9e",
        "name": "Add Row to Google Sheet",
        "credentials": {
          "googleSheetsOAuth2Api": {
            "id": "qJ5ck4AVx9Jx37Fr",
            "name": "Google Sheets account"
          }
        }
      },
      {
        "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": [
          512,
          576
        ],
        "id": "4da67e90-d5b6-42e9-b32a-cf4c0cae2b25",
        "name": "Create a person",
        "credentials": {
          "pipedriveApi": {
            "id": "ytXvRBFzuENwlmQN",
            "name": "Pipedrive account"
          }
        }
      },
      {
        "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": [
          1104,
          576
        ],
        "id": "9c29cb0b-d0cf-4c38-9d68-4806340810e2",
        "name": "Create a note",
        "credentials": {
          "pipedriveApi": {
            "id": "ytXvRBFzuENwlmQN",
            "name": "Pipedrive account"
          }
        }
      },
      {
        "parameters": {
          "content": "## Pipedrive - add person and create note",
          "height": 336,
          "width": 848,
          "color": 7
        },
        "type": "n8n-nodes-base.stickyNote",
        "typeVersion": 1,
        "position": [
          448,
          448
        ],
        "id": "50cc86d5-b061-4c83-87c9-6c8c4c80b9f8",
        "name": "Sticky Note"
      },
      {
        "parameters": {
          "content": "## Append Row in Google Sheet ",
          "height": 336,
          "width": 304,
          "color": 4
        },
        "type": "n8n-nodes-base.stickyNote",
        "typeVersion": 1,
        "position": [
          -256,
          448
        ],
        "id": "40606dab-319e-481b-89bd-c0b8b8c4a0d6",
        "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": "9de6021f-c465-4952-bf96-a2c13f4f0084",
        "name": "Sticky Note3"
      },
      {
        "parameters": {
          "mode": "runOnceForEachItem",
          "jsCode": "return  $input.item;\n"
        },
        "type": "n8n-nodes-base.code",
        "typeVersion": 2,
        "position": [
          192,
          576
        ],
        "id": "d59f0ce4-6ce3-4595-9321-6bdcc82b9ac0",
        "name": "Code"
      },
      {
        "parameters": {
          "content": "## Pre-process\nMake sure data values aren't empty",
          "height": 336,
          "width": 368,
          "color": 3
        },
        "type": "n8n-nodes-base.stickyNote",
        "typeVersion": 1,
        "position": [
          64,
          448
        ],
        "id": "7f12a6fd-1486-43a1-9f25-b198258a7bba",
        "name": "Sticky Note4"
      },
      {
        "parameters": {
          "rule": {
            "interval": [
              {
                "field": "hours"
              }
            ]
          }
        },
        "type": "n8n-nodes-base.scheduleTrigger",
        "typeVersion": 1.2,
        "position": [
          -192,
          208
        ],
        "id": "74751ab3-e7f8-42ca-bef7-c9ff78209ada",
        "name": "Schedule Trigger"
      },
      {
        "parameters": {
          "fieldToSplitOut": "data.purchase_list",
          "options": {}
        },
        "type": "n8n-nodes-base.splitOut",
        "typeVersion": 1,
        "position": [
          256,
          208
        ],
        "id": "ac0244ca-1b18-4adc-b9ea-b5bdcecb5f98",
        "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": "95f05ba8-ac53-44a2-939f-93fa51d400ea",
        "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": "97a5cf75-46ab-4d5b-97b0-29a351d2b5ea",
        "name": "Get Buyer Data",
        "credentials": {
          "httpHeaderAuth": {
            "id": "iye8Q4wTT5P3zqAN",
            "name": "Digistore Header Auth"
          }
        }
      },
      {
        "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": "5f44772a-5ebb-4678-8dfc-43ff9f225a94",
        "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": "f4f4238d-d07a-4415-89fc-9321735ccb74",
        "name": "Get DS24 Orders",
        "credentials": {
          "httpHeaderAuth": {
            "id": "iye8Q4wTT5P3zqAN",
            "name": "Digistore Header Auth"
          }
        }
      },
      {
        "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": "242f79b8-7be3-4daa-aa6b-e60caa8c254e",
        "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": "e339e06a-bbfa-4fac-962c-17dd473c78c4",
        "name": "Code1"
      },
      {
        "parameters": {
          "resource": "person",
          "operation": "get",
          "personId": "={{ $json.id }}"
        },
        "type": "n8n-nodes-base.pipedrive",
        "typeVersion": 1,
        "position": [
          800,
          576
        ],
        "id": "25fca0db-d792-4717-ac66-af80111e9dfe",
        "name": "Get a person",
        "credentials": {
          "pipedriveApi": {
            "id": "ytXvRBFzuENwlmQN",
            "name": "Pipedrive account"
          }
        }
      }
    ],
    "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": [
          [
            {
              "node": "Add Row to Google Sheet",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Get a person": {
        "main": [
          [
            {
              "node": "Create a note",
              "type": "main",
              "index": 0
            }
          ]
        ]
      }
    },
    "nodeGroups": [],
    "authors": "system migration",
    "name": null,
    "description": null,
    "autosaved": false
  },
  "tags": []
}