{
  "meta": {
    "versionId": "1.0.0",
    "createdAt": "2025-09-29T07:07:46.009977",
    "updatedAt": "2025-09-29T07:07:46.010004",
    "owner": "n8n-user",
    "license": "MIT",
    "category": "automation",
    "status": "active",
    "priority": "high",
    "environment": "production"
  },
  "nodes": [
    {
      "id": "6f938c83-45fd-4189-b9ec-c7a6de4beb2d",
      "name": "Retrieve deals Ids",
      "type": "n8n-nodes-base.set",
      "position": [
        660,
        440
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "bad2435b-ec9b-4995-ab39-2dac1c2daa3a",
              "name": "deal_id_won",
              "type": "string",
              "value": "={{ $json.query.deal_id_won }}"
            },
            {
              "id": "2376fad4-c305-4c38-8daa-fd86014ae14b",
              "name": "deal_id_created",
              "type": "string",
              "value": "={{ $json.query.deal_id_created.match(/0-3-(\\d+)$/)[1] }}"
            }
          ]
        }
      },
      "typeVersion": 3.4,
      "notes": "This set node performs automated tasks as part of the workflow."
    },
    {
      "id": "abc534f2-03b4-4f34-8292-bc8011c62c44",
      "name": "Get deal won line items",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        920,
        440
      ],
      "parameters": {
        "url": "{{ $env.API_BASE_URL }}",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"inputs\": [\n    {\n      \"id\": \"{{ $json.deal_id_won }}\"\n    }\n  ]\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "{{ $credentials.predefinedCredentialType }}",
        "nodeCredentialType": "YOUR_CREDENTIAL_HERE"
      },
      "typeVersion": 4.2,
      "notes": "This httpRequest node performs automated tasks as part of the workflow."
    },
    {
      "id": "eb5ae93e-3b52-4a92-9506-5379bbca8e0b",
      "name": "Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        1740,
        440
      ],
      "parameters": {
        "text": "=:white_check_mark: {{ `<{{ $env.WEBHOOK_URL }}{$workflow.id}|${$workflow.name}> sucessfull on <{{ $env.WEBHOOK_URL }}{$('Retrieve deals Ids').item.json[\"deal_id_won\"]}|Deal won> and <{{ $env.WEBHOOK_URL }}{$('Retrieve deals Ids').item.json[\"deal_id_created\"]}|Deal created>`}}\n",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "id",
          "value": "C051YHBJ1G8"
        },
        "otherOptions": {
          "includeLinkToWorkflow": false
        }
      },
      "typeVersion": 2.2,
      "notes": "This slack node performs automated tasks as part of the workflow."
    },
    {
      "id": "d18841d0-a270-4db5-9256-17026985c13b",
      "name": "Get batch SKUs from line items",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1100,
        440
      ],
      "parameters": {
        "url": "{{ $env.API_BASE_URL }}",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ \n\n{\n  \"idProperty\": \"hs_object_id\",\n  \"inputs\": $jmespath($json.results,`[].to[].{id: to_string(toObjectId)}`),\n  \"properties\": [\n    \"hs_object_id\",\n    \"name\",\n    \"hs_sku\"\n  ]\n}\n\n}}",
        "sendBody": true,
        "sendQuery": true,
        "specifyBody": "json",
        "authentication": "{{ $credentials.predefinedCredentialType }}",
        "queryParameters": {
          "parameters": [
            {
              "name": "archived",
              "value": "false"
            }
          ]
        },
        "nodeCredentialType": "YOUR_CREDENTIAL_HERE"
      },
      "typeVersion": 4.2,
      "notes": "This httpRequest node performs automated tasks as part of the workflow."
    },
    {
      "id": "58a9ae81-26d5-47fb-9de7-bf108cb41f8d",
      "name": "Get Batch Product IDs by SKUs",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1320,
        440
      ],
      "parameters": {
        "url": "{{ $env.API_BASE_URL }}",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ {\n  \"idProperty\": \"hs_sku\",\n  \"inputs\":  $jmespath($json.results,\"[].properties.{id:to_string(hs_sku)}\") \n,\n  \"properties\": [\n    \"idProperty\",\n    \"name\",\n    \"hs_object_id\",\n    \"recurringbillingfrequency\",\n\"hs_price_eur\"\n  ]\n}\n\n}}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "{{ $credentials.predefinedCredentialType }}",
        "nodeCredentialType": "YOUR_CREDENTIAL_HERE"
      },
      "typeVersion": 4.2,
      "notes": "This httpRequest node performs automated tasks as part of the workflow."
    },
    {
      "id": "27b2619a-af84-475a-9bdc-c86462ea57d3",
      "name": "Create Batch line items based on productId and associate to deals",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1540,
        440
      ],
      "parameters": {
        "url": "{{ $env.API_BASE_URL }}",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ {\"inputs\":$jmespath($json.results,\"[].id\")\n.map(id => ({\n    \"associations\": [\n        {\n            \"types\": [\n                {\n                    \"associationCategory\": \"HUBSPOT_DEFINED\",\n                    \"associationTypeId\": 20\n                }\n            ],\n            \"to\": {\n                \"id\": $('Retrieve deals Ids').item.json[\"deal_id_created\"]\n            }\n        }\n    ],\n    \"properties\": {\n        \"hs_product_id\": id,\n        \"quantity\": \"1\"\n    }\n})) } \n\n}}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "{{ $credentials.predefinedCredentialType }}",
        "nodeCredentialType": "YOUR_CREDENTIAL_HERE"
      },
      "typeVersion": 4.2,
      "notes": "This httpRequest node performs automated tasks as part of the workflow."
    },
    {
      "id": "f6776d74-c818-4f2b-b05a-5e6b53c2ad5f",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -280,
        200
      ],
      "parameters": {
        "width": 565.8142732633208,
        "height": 838.7224568543345,
        "content": "# Replicate Line Items on New Deal in HubSpot Workflow\n\n## Use Case\nThis workflow solves the problem of manually copying line items from one deal to another in HubSpot, reducing manual work and minimizing errors.\n\n## What this workflow does\n- **Triggers** upon receiving a webhook with deal IDs.\n- **Retrieves** the IDs of the won and created deals.\n- **Fetches** line items associated with the won deal.\n- **Extracts** product SKUs from the retrieved line items.\n- **Fetches** product details based on SKUs.\n- **Creates** new line items for the created deal and associates them.\n- **Sends** a Slack notification with success details.\n\n## Step up steps\n1. Create a HubSpot Deal Workflow\n 1.1 Set up your trigger (ex: when deal stage = Won)\n 1.2 Add step : Create Record (deal)\n 1.3 Add Step : Send webhook. The webhook should be a Get to your n8n first trigger. Set two query parameter : \n   - `deal_id_won` as the Record ID of the deal triggering the HubSpot Workflow\n    - `deal_id_create` as the Record ID of the deal created above. Click Insert Data -> The created object\n2. Set up your HubSpot App token in HubSpot -> Settings -> Integration -> Private Apps\n3. Set up your HubSpot Token integration using the predefined model.\n4. Set up your Slack connection\n5. Add an error Workflow to monitor errors"
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "eefcd96e-c182-4362-bc60-6b5bca42e8a4",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        340,
        300
      ],
      "parameters": {
        "height": 393.4378126446013,
        "content": "**Step 1.**\nTriggered by HubSpot Workflow"
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "9fedd8cf-6d97-428e-8391-aedff191ba5d",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        600,
        300
      ],
      "parameters": {
        "height": 393.4378126446013,
        "content": "**Step 2.**\nSet the Ids of the deal won and the deal created"
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "b00a8849-0a13-40d3-a714-49f0afc54cea",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        860,
        300
      ],
      "parameters": {
        "width": 819.2253746903481,
        "height": 393.4378126446013,
        "content": "**Step 3.**\n- Get line items IDs from the deal won\n- Retrieve the SKUs from those line items\n- Get product based on SKUs\n- Create new line items from Product IDs and associate to the new deal\n"
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "8dc60064-83a1-488e-b1a5-7be57d734e88",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        420,
        440
      ],
      "webhookId": "833df60e-a78f-4a59-8244-9694f27cf8ae",
      "parameters": {
        "path": "833df60e-a78f-4a59-8244-9694f27cf8ae",
        "options": {}
      },
      "typeVersion": 2,
      "notes": "This webhook node performs automated tasks as part of the workflow."
    }
  ],
  "pinData": {},
  "connections": {
    "abc534f2-03b4-4f34-8292-bc8011c62c44": {
      "main": [
        [
          {
            "node": "error-handler-abc534f2-03b4-4f34-8292-bc8011c62c44",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-abc534f2-03b4-4f34-8292-bc8011c62c44-3f2638a0",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-abc534f2-03b4-4f34-8292-bc8011c62c44-11674756",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-abc534f2-03b4-4f34-8292-bc8011c62c44-4f8fc8cf",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-abc534f2-03b4-4f34-8292-bc8011c62c44-639fa46a",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-abc534f2-03b4-4f34-8292-bc8011c62c44-6b7d009f",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-abc534f2-03b4-4f34-8292-bc8011c62c44-7926e098",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-abc534f2-03b4-4f34-8292-bc8011c62c44-70181f90",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-abc534f2-03b4-4f34-8292-bc8011c62c44-3133822b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d18841d0-a270-4db5-9256-17026985c13b": {
      "main": [
        [
          {
            "node": "error-handler-d18841d0-a270-4db5-9256-17026985c13b",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-d18841d0-a270-4db5-9256-17026985c13b-8ffa61f1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-d18841d0-a270-4db5-9256-17026985c13b-50b2863c",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-d18841d0-a270-4db5-9256-17026985c13b-b815bd1d",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-d18841d0-a270-4db5-9256-17026985c13b-84b80061",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-d18841d0-a270-4db5-9256-17026985c13b-72d77f88",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-d18841d0-a270-4db5-9256-17026985c13b-89ce4515",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-d18841d0-a270-4db5-9256-17026985c13b-a45413ca",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-d18841d0-a270-4db5-9256-17026985c13b-535cbc11",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "58a9ae81-26d5-47fb-9de7-bf108cb41f8d": {
      "main": [
        [
          {
            "node": "error-handler-58a9ae81-26d5-47fb-9de7-bf108cb41f8d",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-58a9ae81-26d5-47fb-9de7-bf108cb41f8d-fc7f4e91",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-58a9ae81-26d5-47fb-9de7-bf108cb41f8d-686afd45",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-58a9ae81-26d5-47fb-9de7-bf108cb41f8d-8bb6bdbb",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-58a9ae81-26d5-47fb-9de7-bf108cb41f8d-26af1785",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-58a9ae81-26d5-47fb-9de7-bf108cb41f8d-4552f4f5",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-58a9ae81-26d5-47fb-9de7-bf108cb41f8d-910dd414",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-58a9ae81-26d5-47fb-9de7-bf108cb41f8d-fd3a774d",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-58a9ae81-26d5-47fb-9de7-bf108cb41f8d-ee818279",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "27b2619a-af84-475a-9bdc-c86462ea57d3": {
      "main": [
        [
          {
            "node": "error-handler-27b2619a-af84-475a-9bdc-c86462ea57d3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-27b2619a-af84-475a-9bdc-c86462ea57d3-306bb4b1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-27b2619a-af84-475a-9bdc-c86462ea57d3-d1cd9b7c",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-27b2619a-af84-475a-9bdc-c86462ea57d3-0cd69f66",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-27b2619a-af84-475a-9bdc-c86462ea57d3-4ebfbb03",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-27b2619a-af84-475a-9bdc-c86462ea57d3-262ee27d",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-27b2619a-af84-475a-9bdc-c86462ea57d3-1bf085be",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-27b2619a-af84-475a-9bdc-c86462ea57d3-1d5dbde2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-27b2619a-af84-475a-9bdc-c86462ea57d3-667d31ef",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "8dc60064-83a1-488e-b1a5-7be57d734e88": {
      "main": [
        [
          {
            "node": "error-handler-8dc60064-83a1-488e-b1a5-7be57d734e88",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-8dc60064-83a1-488e-b1a5-7be57d734e88-382eeb08",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-8dc60064-83a1-488e-b1a5-7be57d734e88-d8307739",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-8dc60064-83a1-488e-b1a5-7be57d734e88-9f5c4017",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-8dc60064-83a1-488e-b1a5-7be57d734e88-8719d283",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-8dc60064-83a1-488e-b1a5-7be57d734e88-4410072c",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-8dc60064-83a1-488e-b1a5-7be57d734e88-cafb9d05",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-8dc60064-83a1-488e-b1a5-7be57d734e88-daf70760",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-8dc60064-83a1-488e-b1a5-7be57d734e88-1de63f47",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "eb5ae93e-3b52-4a92-9506-5379bbca8e0b": {
      "main": [
        [
          {
            "node": "error-handler-eb5ae93e-3b52-4a92-9506-5379bbca8e0b-70ffd6f5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "name": "Set Workflow",
  "settings": {
    "executionOrder": "v1",
    "saveManualExecutions": true,
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": null,
    "timezone": "UTC",
    "executionTimeout": 3600,
    "maxExecutions": 1000,
    "retryOnFail": true,
    "retryCount": 3,
    "retryDelay": 1000
  },
  "description": "Automated workflow: Set Workflow. This workflow integrates 6 different services: webhook, stickyNote, httpRequest, set, stopAndError. It contains 22 nodes and follows best practices for error handling and security.",
  "tags": [
    "automation",
    "n8n",
    "production-ready",
    "excellent",
    "optimized"
  ],
  "notes": "Excellent quality workflow: Set Workflow. This workflow has been optimized for production use with comprehensive error handling, security, and documentation."
}