{
  "name": "AUT-204 رویداد سفارش — نسخه ایدمپوتنت",
  "nodes": [
    {
      "parameters": {
        "content": "## نسخه ایدمپوتنت\n۱) پاسخ فوری 200 (فرستنده دوباره نفرستد)\n۲) Remove Duplicates روی event_id\n۳) Idempotency-Key = event_id در ثبت تیکت\nدو لایه: اگر یکی کار نکرد، دیگری جلوی تکرار را می‌گیرد.",
        "height": 200,
        "width": 400,
        "color": 4
      },
      "id": "a55672b4-d508-5be6-b4cf-f243535d91eb",
      "name": "یادداشت 1",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -40,
        -300
      ]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "barg-sabz/events",
        "responseMode": "onReceived",
        "options": {}
      },
      "id": "6fdf3651-e18f-5441-8181-8d1e451a901e",
      "name": "رویداد سفارش",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        0,
        100
      ],
      "webhookId": "7c1e0a52-a204-4e00-9a51-00000000aa02"
    },
    {
      "parameters": {
        "operation": "removeItemsSeenInPreviousExecutions",
        "dedupeValue": "={{ $json.body.event_id }}",
        "options": {}
      },
      "id": "c74403c1-dd28-5761-acf6-23c591cfe174",
      "name": "فقط رویداد تازه",
      "type": "n8n-nodes-base.removeDuplicates",
      "typeVersion": 2,
      "position": [
        240,
        100
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "http://127.0.0.1:8787/tickets",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Idempotency-Key",
              "value": "={{ $json.body.event_id }}"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ customer_ref: $json.body.order_id, category: \"order_shipping\", text: \"order event \" + $json.body.event_id }) }}"
      },
      "id": "26c4ffa2-718e-5fd1-979c-a4a6fca1d12f",
      "name": "ثبت تیکت (با کلید)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        480,
        100
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "aa05db4bc8085d30",
          "name": "Barg Sabz mock API (Header Auth)"
        }
      },
      "retryOnFail": true,
      "maxTries": 3,
      "waitBetweenTries": 2000
    }
  ],
  "connections": {
    "رویداد سفارش": {
      "main": [
        [
          {
            "node": "فقط رویداد تازه",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "فقط رویداد تازه": {
      "main": [
        [
          {
            "node": "ثبت تیکت (با کلید)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "id": "LkyA204Idemp0001",
  "meta": {
    "templateCredsSetupCompleted": false,
    "instanceId": "lookiyar-academy-demo"
  },
  "tags": [
    {
      "name": "loOkiYar Academy"
    },
    {
      "name": "AUT-204"
    }
  ],
  "pinData": {}
}