Workflow 4 of 4 · After-sale care

After-sale question by lot

Hold Space or Ctrl and drag to move the canvas

n8n workflow JSON

After-sale question by lot

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

{
  "nodes": [
    {
      "name": "Customer message",
      "notes": "The chat channel posts each customer message here.",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        300
      ],
      "parameters": {
        "httpMethod": "POST",
        "path": "care/message"
      }
    },
    {
      "name": "Find order or lot",
      "notes": "Pulls an order number or lot code out of the message.",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        220,
        300
      ],
      "parameters": {
        "jsCode": "// Pull an order number or lot code from the message\nreturn items;"
      }
    },
    {
      "name": "Read unit genealogy",
      "notes": "Reads what the plant recorded for that lot in Odoo.",
      "type": "n8n-nodes-base.odoo",
      "typeVersion": 1,
      "position": [
        440,
        300
      ],
      "parameters": {
        "resource": "custom",
        "customResource": "stock.lot",
        "operation": "get"
      }
    },
    {
      "name": "Routine or fault?",
      "notes": "Route 1 answers routine questions; route 2 handles faults.",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        660,
        300
      ],
      "parameters": {}
    },
    {
      "name": "Answer with lot context",
      "notes": "Replies with what the plant recorded for that unit.",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        900,
        180
      ],
      "parameters": {}
    },
    {
      "name": "Open service case",
      "notes": "Opens a Salesforce case with the lot attached.",
      "type": "n8n-nodes-base.salesforce",
      "typeVersion": 1,
      "position": [
        900,
        420
      ],
      "parameters": {
        "resource": "case",
        "operation": "create"
      }
    },
    {
      "name": "Confirm to customer",
      "notes": "Confirms to the customer that a case is open.",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        1120,
        420
      ],
      "parameters": {}
    }
  ],
  "connections": {
    "Customer message": {
      "main": [
        [
          {
            "node": "Find order or lot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find order or lot": {
      "main": [
        [
          {
            "node": "Read unit genealogy",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read unit genealogy": {
      "main": [
        [
          {
            "node": "Routine or fault?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Routine or fault?": {
      "main": [
        [
          {
            "node": "Answer with lot context",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Open service case",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Open service case": {
      "main": [
        [
          {
            "node": "Confirm to customer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}