{
  "name": "Nodbot - Linear issue router with GraphQL dedupe",
  "nodes": [
    {
      "parameters": {
        "path": "integration-linear-n8n-issue-router",
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "id": "4bc9d724-e085-4879-bdf8-ad0638c2f375",
      "name": "Webhook Linear event",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        260
      ]
    },
    {
      "parameters": {
        "jsCode": "const src = $json.body ?? $json;\nconst teams = { PAY: 'linear-team-payments', WEB: 'linear-team-web' };\nconst priorities = { urgent: 1, high: 2, medium: 3, low: 4 };\nconst teamKey = String(src.team_key ?? 'WEB').trim().toUpperCase();\nif (!teams[teamKey]) throw new Error(`Linear team is not allowed: ${teamKey}`);\nconst entityId = String(src.entity_id ?? '').trim();\nif (!entityId) throw new Error('No entity_id for Linear issue');\nconst priorityKey = String(src.priority ?? 'medium').toLowerCase();\nconst externalId = `linear-router:${src.source ?? 'external'}:${entityId}`;\nconst labels = Array.isArray(src.labels) ? src.labels.map(String).slice(0, 8) : [];\nconst title = String(src.title ?? 'External issue').trim().slice(0, 180);\nconst description = [String(src.description ?? '').trim(), '', `External ID: ${externalId}`, `Source: ${src.source ?? 'external'}`, `Impact: ${src.customer_impact ?? 'n/a'}`, `URL: ${src.source_url ?? ''}`].join('\n');\nreturn [{ json: {\n  external_id: externalId,\n  find_query: externalId,\n  mutation: {\n    teamId: teams[teamKey],\n    title,\n    description,\n    priority: priorities[priorityKey] ?? 3,\n    labels,\n    projectKey: src.project_key ?? null\n  },\n  comment: `Повторное событие для ${externalId}`\n}}];"
      },
      "id": "ad3aa09f-25ec-41c8-8a40-b48cefbc340e",
      "name": "Validate Linear mapping",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        280,
        260
      ]
    },
    {
      "parameters": {},
      "id": "df337f68-91c0-4c74-8064-2cec75ca649c",
      "name": "Find existing Linear issue",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 2,
      "position": [
        560,
        260
      ]
    },
    {
      "parameters": {},
      "id": "8d476d0a-6069-443d-845e-cd5e1aa16bfa",
      "name": "Create or update Linear issue",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 2,
      "position": [
        840,
        260
      ]
    },
    {
      "parameters": {},
      "id": "515230b5-5da3-4a71-b260-f5480ecce5fc",
      "name": "Notify owner",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 2,
      "position": [
        1120,
        260
      ]
    },
    {
      "parameters": {},
      "id": "d231b2d9-0ca0-4e22-8df9-a5f317b306e1",
      "name": "Respond",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 2,
      "position": [
        1400,
        260
      ]
    }
  ],
  "connections": {
    "Webhook Linear event": {
      "main": [
        [
          {
            "node": "Validate Linear mapping",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate Linear mapping": {
      "main": [
        [
          {
            "node": "Find existing Linear issue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find existing Linear issue": {
      "main": [
        [
          {
            "node": "Create or update Linear issue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create or update Linear issue": {
      "main": [
        [
          {
            "node": "Notify owner",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notify owner": {
      "main": [
        [
          {
            "node": "Respond",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "tags": [
    "nodbot",
    "integration",
    "production"
  ],
  "triggerCount": 1,
  "updatedAt": "2026-05-30T00:00:00.000Z",
  "versionId": "06caf73f-bcf7-434d-9412-6f42d7a13797",
  "meta": {
    "templateCredsSetupCompleted": false
  }
}