{
  "name": "IR-CLU \u2014 \u062f\u0631\u06cc\u0627\u0641\u062a \u0644\u06cc\u062f \u0627\u0632 \u062a\u0633\u062a \u062a\u0634\u062e\u06cc\u0635 \u0627\u062a\u0648\u0645\u0627\u0633\u06cc\u0648\u0646",
  "nodes": [
    {
      "id": "webhook-quiz-lead",
      "name": "\u062f\u0631\u06cc\u0627\u0641\u062a \u067e\u0627\u0633\u062e \u062a\u0633\u062a",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        -720,
        0
      ],
      "parameters": {
        "httpMethod": "POST",
        "path": "quiz-lead",
        "responseMode": "onReceived",
        "options": {
          "allowedOrigins": "*"
        }
      }
    },
    {
      "id": "code-format-lead",
      "name": "\u0633\u0627\u062e\u062a \u0631\u062f\u06cc\u0641 \u0644\u06cc\u062f",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -480,
        0
      ],
      "parameters": {
        "jsCode": "const body = $input.first().json.body ?? $input.first().json;\n\nconst categoryLabels = {\n  \"telegram-bot\": \"\u0631\u0628\u0627\u062a \u062a\u0644\u06af\u0631\u0627\u0645/\u0628\u0644\u0647\",\n  \"n8n-integration\": \"\u06cc\u06a9\u067e\u0627\u0631\u0686\u0647\u200c\u0633\u0627\u0632\u06cc \u0628\u0627 n8n\",\n  \"custom-app\": \"\u0627\u067e\u0644\u06cc\u06a9\u06cc\u0634\u0646/\u0627\u06cc\u062c\u0646\u062a \u0627\u062e\u062a\u0635\u0627\u0635\u06cc\",\n  \"store-product\": \"\u0645\u062d\u0635\u0648\u0644 \u0627\u0634\u062a\u0631\u0627\u06a9\u06cc\",\n};\n\nconst answersText = (body.answers || [])\n  .map((a) => `- ${a.question}\\n  ${a.answer}`)\n  .join(\"\\n\");\n\nreturn [{\n  json: {\n    date: new Date().toISOString(),\n    name: body.name || \"(\u0628\u062f\u0648\u0646 \u0646\u0627\u0645)\",\n    contact: body.contact || \"\",\n    category: categoryLabels[body.category] || body.category,\n    answersText,\n  },\n}];"
      }
    },
    {
      "id": "sheets-append-lead",
      "name": "\u0627\u0641\u0632\u0648\u062f\u0646 \u0628\u0647 \u0634\u06cc\u062a Quiz Leads",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        -240,
        0
      ],
      "parameters": {
        "operation": "append",
        "documentId": {
          "mode": "list",
          "value": "PLACEHOLDER_SPREADSHEET_ID"
        },
        "sheetName": {
          "mode": "name",
          "value": "Quiz Leads"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "date": "={{ $json.date }}",
            "name": "={{ $json.name }}",
            "contact": "={{ $json.contact }}",
            "category": "={{ $json.category }}",
            "answers": "={{ $json.answersText }}"
          }
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "telegram-notify-lead",
      "name": "\u0627\u0637\u0644\u0627\u0639 \u062f\u0631 \u062a\u0644\u06af\u0631\u0627\u0645",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        0,
        0
      ],
      "parameters": {
        "resource": "message",
        "operation": "sendMessage",
        "chatId": "PLACEHOLDER_CHAT_ID",
        "text": "=\ud83c\udfaf \u0644\u06cc\u062f \u062c\u062f\u06cc\u062f \u0627\u0632 \u062a\u0633\u062a \u062a\u0634\u062e\u06cc\u0635 \u0627\u062a\u0648\u0645\u0627\u0633\u06cc\u0648\u0646:\n\n\u0646\u0627\u0645: {{ $json.name }}\n\u062a\u0645\u0627\u0633: {{ $json.contact }}\n\u067e\u06cc\u0634\u0646\u0647\u0627\u062f \u0628\u0647 \u06a9\u0627\u0631\u0628\u0631: {{ $json.category }}\n\n\u067e\u0627\u0633\u062e\u200c\u0647\u0627:\n{{ $json.answersText }}"
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "\u062f\u0631\u06cc\u0627\u0641\u062a \u067e\u0627\u0633\u062e \u062a\u0633\u062a": {
      "main": [
        [
          {
            "node": "\u0633\u0627\u062e\u062a \u0631\u062f\u06cc\u0641 \u0644\u06cc\u062f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0633\u0627\u062e\u062a \u0631\u062f\u06cc\u0641 \u0644\u06cc\u062f": {
      "main": [
        [
          {
            "node": "\u0627\u0641\u0632\u0648\u062f\u0646 \u0628\u0647 \u0634\u06cc\u062a Quiz Leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0627\u0641\u0632\u0648\u062f\u0646 \u0628\u0647 \u0634\u06cc\u062a Quiz Leads": {
      "main": [
        [
          {
            "node": "\u0627\u0637\u0644\u0627\u0639 \u062f\u0631 \u062a\u0644\u06af\u0631\u0627\u0645",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  }
}