{
  "name": "Automatically correct wrong shipping addresses in Billbee orders",
  "nodes": [
    {
      "id": "c6e389ae-6db2-416b-8f6f-91749fbc860f",
      "name": "get order data",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2500,
        880
      ]
    },
    {
      "id": "1b27594b-af74-4c25-bb4f-27550bcd152e",
      "name": "Split Out Order Data",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        2660,
        880
      ]
    },
    {
      "id": "43808f6f-815d-419c-9e6f-c12d436108f2",
      "name": "Set Address Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        2820,
        880
      ]
    },
    {
      "id": "3e5f3fc5-d3e2-4f4a-978e-795893e016cc",
      "name": "Check Address endereco api",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4140,
        760
      ]
    },
    {
      "id": "3b02a11e-719b-41ef-b84f-b1e06d83854a",
      "name": "Split Out Corrected Address",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        4600,
        720
      ]
    },
    {
      "id": "a3b6135a-6a0e-4c37-95ef-6e33f14c5e74",
      "name": "set new delivery address to billbee",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4920,
        720
      ]
    },
    {
      "id": "b170217c-b2d7-4514-b070-403e29964e4b",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        2120,
        960
      ]
    },
    {
      "id": "17ea8895-05cd-4ffd-af31-aace970f8073",
      "name": "Wait1",
      "type": "n8n-nodes-base.wait",
      "position": [
        4760,
        720
      ]
    },
    {
      "id": "d8d005e4-3b94-49d6-82dc-2919ca69dd2f",
      "name": "check if new address is not empty",
      "type": "n8n-nodes-base.if",
      "position": [
        4320,
        760
      ]
    },
    {
      "id": "3ad15e79-e4c8-4adf-90a5-aaf61cfe4825",
      "name": "set billbee tag",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4580,
        920
      ]
    },
    {
      "id": "6b0e5cfb-95d5-43a0-a665-6b8db6b6ad98",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2260,
        820
      ],
      "parameters": {
        "width": 481,
        "height": 198,
        "content": "## Get and Prepare Oder Data"
      }
    },
    {
      "id": "a2524895-b0dd-492b-b425-548ccbabf5c2",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        460,
        460
      ],
      "parameters": {
        "width": 1110.4301052736698,
        "height": 544.444950562247,
        "content": "# **Address Validation Workflow**\n### **Requirements**\n- **Billbee Developer API Key**: Request via email: `support@billbee.io`.\n- **Billbee User API Key**: Found in the **Billbee settings**.\n- **Ende"
      }
    },
    {
      "id": "31bb6e73-e702-4577-8b7f-a9850e80cbaf",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1060,
        1040
      ],
      "parameters": {
        "width": 276,
        "height": 219,
        "content": "## API Docs\n\nEndereco:\nhttps://github.com/Endereco/enderecoservice_api\n\nBillbee:\nhttps://app.billbee.io//swagger/ui/index\n"
      }
    },
    {
      "id": "4bb9d0c1-0838-449b-bb1e-c4912173d9df",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        460,
        1040
      ],
      "parameters": {
        "width": 574.5277463210057,
        "height": 573.7065374509425,
        "content": "### Bilbee Setup \n### **Rule Settings**\n- **Name of the Rule:** Endereco Address Validation\n- **Comment:** *No comment provided.*\n- **Active:** ✅ Active\n- **Stop Rule Processing After This Rule:** ⬜ D"
      }
    },
    {
      "id": "ad409a55-db7f-4699-9d56-98d7a2164afe",
      "name": "check if housenumer is not empty",
      "type": "n8n-nodes-base.if",
      "position": [
        3260,
        880
      ]
    },
    {
      "id": "0131cf4e-983b-4cc5-8305-e4a644f9e700",
      "name": "check if addressline 2 contains number",
      "type": "n8n-nodes-base.if",
      "position": [
        3420,
        980
      ]
    },
    {
      "id": "14d67019-a6c2-4ad4-9c0e-383ee3e1f3e9",
      "name": "Filter",
      "type": "n8n-nodes-base.filter",
      "position": [
        1360,
        1320
      ]
    },
    {
      "id": "851d9d42-2b50-4a40-8d46-7d3decf897c2",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1080,
        1300
      ],
      "parameters": {
        "width": null,
        "height": 239.63602562365423,
        "content": "## Include Filter \nYou want to filter out PickUp Shops or Parcel Stations for example in Germany:\n\n\"Postfiliale, Paketshop, Packstation\"\n\nThis can also be set up within Billbee"
      }
    },
    {
      "id": "a07c7816-bcb6-457d-a621-ccfebcc384ad",
      "name": "set value of addressline2 as housenumber",
      "type": "n8n-nodes-base.set",
      "position": [
        3600,
        900
      ]
    },
    {
      "id": "c22fb34a-252f-4570-b576-089bb3243bfd",
      "name": "Filter Out PickUpShops",
      "type": "n8n-nodes-base.filter",
      "position": [
        3040,
        880
      ]
    },
    {
      "id": "b2b3c72a-d3d0-467f-8f60-17f40c7a3650",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3020,
        820
      ],
      "parameters": {
        "width": 155.04025478630723,
        "height": 185.20127393153615,
        "content": "## Open ME!"
      }
    },
    {
      "id": "ea2e9abf-1461-4754-b663-83e771207627",
      "name": "check if addressline 2 contains number and letter",
      "type": "n8n-nodes-base.if",
      "position": [
        3560,
        1080
      ]
    },
    {
      "id": "b532b22f-421e-4bd8-8241-ca559e77c3ca",
      "name": "set billbee tag manual check",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3780,
        1200
      ]
    },
    {
      "id": "bdb10514-2fa7-4727-a8e7-aa8394fced6f",
      "name": "set value of addressline2 as housenumber number+letter",
      "type": "n8n-nodes-base.set",
      "position": [
        3760,
        1020
      ]
    },
    {
      "id": "cf0a516f-f019-40f8-8d09-ff02a034781d",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3000,
        760
      ],
      "parameters": {
        "width": 907.6568579769853,
        "height": 627.257034553087,
        "content": "## House Number Validation"
      }
    },
    {
      "id": "82a16bec-77e9-4717-8111-69f8f068c925",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4040,
        700
      ],
      "parameters": {
        "width": 1325.4150814203485,
        "height": 354.5727675883748,
        "content": "## Address Validation & Correction"
      }
    },
    {
      "id": "07f54a0d-2b13-4996-95a4-4c225402abe1",
      "name": "set billbee success",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        5080,
        720
      ]
    },
    {
      "id": "bd2f3340-f389-48e1-a90d-1625b6845556",
      "name": "ConfigNode",
      "type": "n8n-nodes-base.set",
      "position": [
        1860,
        960
      ]
    },
    {
      "id": "7619e573-116a-4f87-b6d2-b652ee7a25b7",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1800,
        1120
      ],
      "parameters": {
        "width": null,
        "height": 251.61012258936577,
        "content": "### **Setup**\n\n**Create an Basic Auth for BillbeeUser**\n-E-Mail as Username, Password User API Key\n\nPaste your Billbee Developer Key (X Key) and Endereco API Key\n\n"
      }
    },
    {
      "id": "31c17f6e-0e90-4db1-9048-4b13bd36cc90",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2500,
        1100
      ],
      "parameters": {
        "width": 150,
        "height": 135.6842625042993,
        "content": "### **Setup**\n\nSelect your BillbeeUser Basic Auth \n\n"
      }
    },
    {
      "id": "ca1e1a8b-6107-4e0c-81c4-2a3b715aed11",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        1640,
        960
      ]
    }
  ],
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "get order data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait1": {
      "main": [
        [
          {
            "node": "set new delivery address to billbee",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "ConfigNode",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ConfigNode": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "get order data": {
      "main": [
        [
          {
            "node": "Split Out Order Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Address Fields": {
      "main": [
        [
          {
            "node": "Filter Out PickUpShops",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Order Data": {
      "main": [
        [
          {
            "node": "Set Address Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Out PickUpShops": {
      "main": [
        [
          {
            "node": "check if housenumer is not empty",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Address endereco api": {
      "main": [
        [
          {
            "node": "check if new address is not empty",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Corrected Address": {
      "main": [
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "check if housenumer is not empty": {
      "main": [
        [
          {
            "node": "Check Address endereco api",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "check if addressline 2 contains number",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "check if new address is not empty": {
      "main": [
        [
          {
            "node": "Split Out Corrected Address",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "set billbee tag",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "set new delivery address to billbee": {
      "main": [
        [
          {
            "node": "set billbee success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "check if addressline 2 contains number": {
      "main": [
        [
          {
            "node": "set value of addressline2 as housenumber",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "check if addressline 2 contains number and letter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "set value of addressline2 as housenumber": {
      "main": [
        [
          {
            "node": "Check Address endereco api",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "check if addressline 2 contains number and letter": {
      "main": [
        [
          {
            "node": "set value of addressline2 as housenumber number+letter",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "set billbee tag manual check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "set value of addressline2 as housenumber number+letter": {
      "main": [
        [
          {
            "node": "Check Address endereco api",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}