Section 2 APIs authentication and integration patterns - hands on exercise webhook driver order processing system

Describe the problem/error/question

✓ Valid order returns 200 with correct response
✗ Missing fields returns 400 with error status. Expected 400 error for missing required fields
✓ Missing authentication returns 403

faield to pass the webhook tester, already follow instruction 100% but still failed.

What is the error message (if any)?

**✓**Valid order returns 200 with correct response

**✗**Missing fields returns 400 with error status. Expected 400 error for missing required fields

**✓**Missing authentication returns 403

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
{
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "course/n8n102/new-order",
        "authentication": "headerAuth",
        "responseMode": "responseNode",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        0,
        0
      ],
      "id": "e562e52c-483b-4084-a08b-96a9ff6bf1a9",
      "name": "WebhookNewOrder",
      "webhookId": "01db53d7-73ec-40c2-b91b-2c97da6e2535",
      "credentials": {
        "httpHeaderAuth": {
          "id": "IZ1z1MYLBwpoKx2J",
          "name": "n8n Academy API Key"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "a65d16fa-2ec8-48ee-898e-a0ef28462992",
              "leftValue": "={{ $json.body.order_id }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            },
            {
              "id": "3c8039b7-3a17-4387-805c-59ea5ff40377",
              "leftValue": "={{ $json.body.customer_id }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            },
            {
              "id": "19ef2054-2b99-4b20-9a17-e4f900b9d050",
              "leftValue": "={{ $json.body.total }}",
              "rightValue": "",
              "operator": {
                "type": "number",
                "operation": "notEmpty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        208,
        0
      ],
      "id": "14611c3e-1eb2-4802-8fbc-2309d1a7074e",
      "name": "ValidateRequiredFields"
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={\n  \"status\": \"accepted\",\n  \"order_id\": \"{{ $('WebhookNewOrder').item.json.body.order_id }}\",\n  \"message\": \"Order received and queued for processing\"\n}",
        "options": {
          "responseCode": 200
        }
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.5,
      "position": [
        416,
        -96
      ],
      "id": "d1fd5364-556a-46d4-9240-fb84f22e9767",
      "name": "RespondSuccess"
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={\n  \"status\": \"error\",\n  \"message\": \"Missing required fields: order_id, customer_id, and total are required\"\n}",
        "options": {
          "responseCode": 400
        }
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.5,
      "position": [
        416,
        96
      ],
      "id": "c7dad4f2-1f70-4138-914c-144de8643f7e",
      "name": "RespondValidationError"
    }
  ],
  "connections": {
    "WebhookNewOrder": {
      "main": [
        [
          {
            "node": "ValidateRequiredFields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ValidateRequiredFields": {
      "main": [
        [
          {
            "node": "RespondSuccess",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "RespondValidationError",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "bed2988fb684ee16b2cfbdee45dcd5e341307ecfd375cd84c432f4ed9cece2d3"
  }
}

Share the output returned by the last node

Information on your n8n setup

    1. n8n version: 2.15.0
    2. Database: SQLite (default)
    3. EXECUTIONS_PROCESS setting: main
    4. Running n8n via: Docker (on Zeabur)
    5. Operating system: Linux (Ubuntu 24, Zeabur hosted)

This is a type mismatch condition

i changed to string … also cant resolve … not sure what problem mismatch.. .alr follow instruction given

Hello,

We had a bug which has been resolved.

cheers,