{
  "name": "Nodbot - Jira issue router with JQL dedupe",
  "nodes": [
    {
      "parameters": {
        "path": "integration-jira-n8n-issue-router",
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "id": "b3f6608c-4a6b-4809-8c55-2126d8ad7976",
      "name": "Webhook issue input",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        260
      ]
    },
    {
      "parameters": {
        "jsCode": "const src = $json.body ?? $json;\nconst allowedProjects = ['OPS', 'WEB', 'CRM'];\nconst projectKey = String(src.project_key ?? 'OPS').trim().toUpperCase();\nif (!allowedProjects.includes(projectKey)) throw new Error(`Project is not allowed: ${projectKey}`);\nconst issueType = String(src.issue_type ?? 'Task').trim();\nconst allowedTypes = ['Bug', 'Task', 'Incident'];\nif (!allowedTypes.includes(issueType)) throw new Error(`Issue type is not allowed: ${issueType}`);\nconst entityId = String(src.entity_id ?? '').trim();\nif (!entityId) throw new Error('No entity_id for Jira issue');\nconst severity = String(src.severity ?? 'medium').toLowerCase();\nconst externalId = `jira-router:${src.source ?? 'external'}:${entityId}`;\nconst summary = String(src.summary ?? src.title ?? 'External event').trim().slice(0, 180);\nconst description = [String(src.description ?? '').trim(), '', `Source: ${src.source ?? 'external'}`, `Entity: ${entityId}`, `Service: ${src.service ?? 'n/a'}`, `Environment: ${src.environment ?? 'n/a'}`, `URL: ${src.source_url ?? ''}`].join('\\n');\nconst jql = `project = ${projectKey} AND labels = \"external-sync\" AND text ~ \"${externalId}\" ORDER BY created DESC`;\nreturn [{ json: { external_id: externalId, jql, issue: { fields: { project: { key: projectKey }, issuetype: { name: issueType }, summary, description, labels: ['external-sync', `severity-${severity}`] } }, comment: `Repeated event for ${externalId}`, allowed_transition: severity === 'critical' ? 'Escalate' : 'Triage' }}];"
      },
      "id": "e709d1b2-1c2a-4025-8c92-25620c3aba1b",
      "name": "Validate and build Jira issue",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        280,
        260
      ]
    },
    {
      "parameters": {},
      "id": "ad4f0de6-892c-435c-895f-52543da3c448",
      "name": "Find duplicate via JQL",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 2,
      "position": [
        560,
        260
      ]
    },
    {
      "parameters": {},
      "id": "3c4059f1-e4bf-462d-917f-551a544074cf",
      "name": "Create or update issue",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 2,
      "position": [
        840,
        260
      ]
    },
    {
      "parameters": {},
      "id": "a099fbd5-841e-4cc2-b65d-24de3f6b685a",
      "name": "Apply safe transition",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 2,
      "position": [
        1120,
        260
      ]
    },
    {
      "parameters": {},
      "id": "ef1581c9-be9c-4ebf-b625-b78d7a24c943",
      "name": "Respond",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 2,
      "position": [
        1400,
        260
      ]
    }
  ],
  "connections": {
    "Webhook issue input": {
      "main": [
        [
          {
            "node": "Validate and build Jira issue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate and build Jira issue": {
      "main": [
        [
          {
            "node": "Find duplicate via JQL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find duplicate via JQL": {
      "main": [
        [
          {
            "node": "Create or update issue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create or update issue": {
      "main": [
        [
          {
            "node": "Apply safe transition",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Apply safe transition": {
      "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": "befe366b-b17a-432b-9381-3e1fac178b7e",
  "meta": {
    "templateCredsSetupCompleted": false
  }
}