AutomationFlowsWeb Scraping › Saleor-erpnext Order Sync

Saleor-erpnext Order Sync

Saleor-ERPNext Order Sync. Uses httpRequest. Webhook trigger; 9 nodes.

Webhook trigger★★★★☆ complexity9 nodesHTTP Request
Web Scraping Trigger: Webhook Nodes: 9 Complexity: ★★★★☆ Added:

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Saleor-ERPNext Order Sync",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "sync-orders",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "webhook-trigger",
      "name": "Webhook Trigger",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "url": "http://host.docker.internal:3000/api/n8n/trigger/sync-orders/{{ $json.tenant_slug }}",
        "options": {
          "timeout": 30000
        }
      },
      "id": "trigger-sync",
      "name": "Trigger Order Sync",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        460,
        300
      ]
    },
    {
      "parameters": {
        "url": "http://host.docker.internal:3000/api/tenants/{{ $json.tenant_slug }}/saleor/orders",
        "options": {
          "timeout": 30000
        }
      },
      "id": "get-saleor-orders",
      "name": "Get Saleor Orders",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        680,
        200
      ]
    },
    {
      "parameters": {
        "url": "http://host.docker.internal:3000/api/tenants/{{ $json.tenant_slug }}/erpnext/customers",
        "options": {
          "timeout": 30000
        }
      },
      "id": "get-erpnext-customers",
      "name": "Get ERPNext Customers",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        680,
        400
      ]
    },
    {
      "parameters": {
        "jsCode": "// Process orders and create customer leads in ERPNext\nconst saleorOrders = $('Get Saleor Orders').first().json.orders?.edges || [];\nconst erpnextCustomers = $('Get ERPNext Customers').first().json || [];\n\nconst syncData = {\n  tenant_slug: $('Webhook Trigger').first().json.tenant_slug,\n  sync_timestamp: new Date().toISOString(),\n  saleor_orders_count: saleorOrders.length,\n  erpnext_customers_count: erpnextCustomers.length,\n  new_leads_to_create: [],\n  orders_to_process: []\n};\n\n// Process each order\nfor (const orderEdge of saleorOrders) {\n  const order = orderEdge.node;\n  const customer = order.user;\n  \n  // Check if customer exists in ERPNext\n  const existingCustomer = erpnextCustomers.find(cust => \n    cust.email_id === customer.email ||\n    cust.customer_name === `${customer.firstName} ${customer.lastName}`\n  );\n  \n  if (!existingCustomer && customer.email) {\n    // Create lead for new customer\n    syncData.new_leads_to_create.push({\n      lead_name: `${customer.firstName} ${customer.lastName}`,\n      email_id: customer.email,\n      mobile_no: customer.phone || '',\n      source: 'Saleor E-commerce',\n      status: 'Lead',\n      notes: `Order #${order.number} - Total: ${order.total.gross.amount} ${order.total.gross.currency}`\n    });\n  }\n  \n  // Add order for processing\n  syncData.orders_to_process.push({\n    order_id: order.id,\n    order_number: order.number,\n    customer_email: customer.email,\n    total_amount: order.total.gross.amount,\n    currency: order.total.gross.currency,\n    status: order.status,\n    created_at: order.created,\n    line_items: order.lines?.map(line => ({\n      product_name: line.productName,\n      quantity: line.quantity,\n      unit_price: line.unitPrice.gross.amount\n    })) || []\n  });\n}\n\nreturn { json: syncData };"
      },
      "id": "process-orders",
      "name": "Process Orders",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        900,
        300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "id": "condition-1",
              "leftValue": "{{ $json.new_leads_to_create.length }}",
              "rightValue": 0,
              "operator": {
                "type": "number",
                "operation": "gt"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "check-leads",
      "name": "Check if Leads to Create",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        1120,
        300
      ]
    },
    {
      "parameters": {
        "url": "http://host.docker.internal:3000/api/tenants/{{ $json.tenant_slug }}/erpnext/leads",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "{{ $json.new_leads_to_create[0] }}",
        "options": {
          "timeout": 30000
        }
      },
      "id": "create-lead",
      "name": "Create Lead in ERPNext",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        1340,
        200
      ]
    },
    {
      "parameters": {
        "url": "http://host.docker.internal:3000/api/n8n/execute/{{ $json.tenant_slug }}",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "{\n  \"workflow\": \"order-sync\",\n  \"data\": {{ JSON.stringify($json) }}\n}",
        "options": {
          "timeout": 30000
        }
      },
      "id": "log-execution",
      "name": "Log Execution",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        1560,
        300
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "{\n  \"success\": true,\n  \"message\": \"Order sync workflow completed\",\n  \"data\": {{ JSON.stringify($json) }}\n}"
      },
      "id": "respond",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        1780,
        300
      ]
    }
  ],
  "connections": {
    "Webhook Trigger": {
      "main": [
        [
          {
            "node": "Trigger Order Sync",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger Order Sync": {
      "main": [
        [
          {
            "node": "Get Saleor Orders",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get ERPNext Customers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Saleor Orders": {
      "main": [
        [
          {
            "node": "Process Orders",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get ERPNext Customers": {
      "main": [
        [
          {
            "node": "Process Orders",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Orders": {
      "main": [
        [
          {
            "node": "Check if Leads to Create",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if Leads to Create": {
      "main": [
        [
          {
            "node": "Create Lead in ERPNext",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Log Execution",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Lead in ERPNext": {
      "main": [
        [
          {
            "node": "Log Execution",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Execution": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "1",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "order-sync-workflow",
  "tags": [
    "saleor",
    "erpnext",
    "sync",
    "orders",
    "customers"
  ]
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Saleor-ERPNext Order Sync. Uses httpRequest. Webhook trigger; 9 nodes.

Source: https://github.com/itsMrApon/sts_platform/blob/d669d84345fe6120d9d4ae8c3290963329f8a390/n8n-workflows/order-sync-workflow.json — original creator credit. Request a take-down →

More Web Scraping workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Web Scraping

This n8n template provides enterprise-level version control for your workflows using GitHub integration. Stop losing hours to broken workflows and manual exports – get proper commit history, visual di

n8n, Execute Workflow Trigger, HTTP Request +1
Web Scraping

This flow creates dummy files for every item added in your *Arrs (Radarr/Sonarr) with the tag .

HTTP Request, Ssh
Web Scraping

This workflow acts as a central API gateway for all technical indicator agents in the Binance Spot Market Quant AI system. It listens for incoming webhook requests and dynamically routes them to the c

HTTP Request
Web Scraping

Sign PDF documents with legally-compliant digital signatures using X.509 certificates. Supports multiple PAdES signature levels (B, T, LT, LTA) with optional visible stamps.

Execute Command, HTTP Request, Read Write File +1
Web Scraping

📡 This workflow serves as the central Alpha Vantage API fetcher for Tesla trading indicators, delivering cleaned 20-point JSON outputs for three timeframes: , , and . It is required by the following a

HTTP Request