Workflow 2 of 4 · Inspection

Inspection, rework, and alert

Hold Space or Ctrl and drag to move the canvas

n8n workflow JSON

Inspection, rework, and alert

Paste this into an n8n editor to import the workflow. Credentials and endpoints are placeholders.

{
  "nodes": [
    {
      "name": "Inspection submitted",
      "notes": "The inspection station posts the unit's measurements here.",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        300
      ],
      "parameters": {
        "httpMethod": "POST",
        "path": "quality/inspection"
      }
    },
    {
      "name": "Get product spec",
      "notes": "Reads the tolerances for this product from the spec sheet.",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        220,
        300
      ],
      "parameters": {
        "operation": "read"
      }
    },
    {
      "name": "Compare to tolerance",
      "notes": "Checks each measurement against its tolerance; any miss is a fail.",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        440,
        300
      ],
      "parameters": {
        "jsCode": "// Each measurement against spec; any miss is a FAIL\nreturn items;"
      }
    },
    {
      "name": "Pass?",
      "notes": "True releases the unit; false sends it to rework.",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        660,
        300
      ],
      "parameters": {}
    },
    {
      "name": "Release unit to packing",
      "notes": "Moves the work order on to packing.",
      "type": "n8n-nodes-base.odoo",
      "typeVersion": 1,
      "position": [
        900,
        160
      ],
      "parameters": {
        "resource": "custom",
        "customResource": "mrp.workorder",
        "operation": "update"
      }
    },
    {
      "name": "Open rework route",
      "notes": "Opens rework under the same unit identity, so history is kept.",
      "type": "n8n-nodes-base.odoo",
      "typeVersion": 1,
      "position": [
        900,
        440
      ],
      "parameters": {
        "resource": "custom",
        "customResource": "mrp.workorder",
        "operation": "create"
      }
    },
    {
      "name": "Alert quality lead",
      "notes": "Tells the quality lead which value failed and on which unit.",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.2,
      "position": [
        1120,
        440
      ],
      "parameters": {
        "resource": "message",
        "operation": "post"
      }
    },
    {
      "name": "Log inspection record",
      "notes": "Appends the inspection result to the quality log.",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        1340,
        300
      ],
      "parameters": {
        "operation": "append"
      }
    }
  ],
  "connections": {
    "Inspection submitted": {
      "main": [
        [
          {
            "node": "Get product spec",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get product spec": {
      "main": [
        [
          {
            "node": "Compare to tolerance",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Compare to tolerance": {
      "main": [
        [
          {
            "node": "Pass?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pass?": {
      "main": [
        [
          {
            "node": "Release unit to packing",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Open rework route",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Release unit to packing": {
      "main": [
        [
          {
            "node": "Log inspection record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Open rework route": {
      "main": [
        [
          {
            "node": "Alert quality lead",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Alert quality lead": {
      "main": [
        [
          {
            "node": "Log inspection record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}