{
  "name": "Nodbot - Asana task sync with dedupe",
  "nodes": [
    {
      "parameters": {
        "path": "integration-asana-n8n-task-sync",
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "id": "35cb6746-df41-4df0-9db3-66e26453d8c4",
      "name": "Webhook task event",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        260
      ]
    },
    {
      "parameters": {
        "jsCode": "const src = $json.body ?? $json;\nconst source = String(src.source ?? 'external').trim().toLowerCase();\nconst entityId = String(src.entity_id ?? src.id ?? '').trim();\nif (!entityId) throw new Error('No entity_id for Asana task sync');\nconst title = String(src.title ?? '').trim();\nif (title.length < 5) throw new Error('Task title is too short');\nconst dueDate = String(src.due_date ?? '').trim();\nif (dueDate && !/^\\d{4}-\\d{2}-\\d{2}$/.test(dueDate)) throw new Error(`Invalid Asana due_date: ${dueDate}`);\nconst assigneeEmail = String(src.assignee_email ?? '').trim().toLowerCase();\nconst externalId = `asana-sync:${source}:${entityId}`;\nreturn [{ json: { external_id: externalId, task: {\n  name: title.slice(0, 120),\n  notes: `${src.description ?? ''}\\n\\nSource: ${source}\\nEntity: ${entityId}\\nURL: ${src.source_url ?? ''}`,\n  projects: [String(src.project_gid ?? '').trim()].filter(Boolean),\n  memberships: src.section_gid ? [{ section: String(src.section_gid) }] : [],\n  due_on: dueDate || undefined,\n  assignee_email: assigneeEmail || undefined,\n  custom_fields: { external_id: externalId, priority: String(src.priority ?? 'normal') }\n}} }];"
      },
      "id": "9877457d-8d16-4700-ad82-f42fa1603a27",
      "name": "Normalize Asana fields",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        280,
        260
      ]
    },
    {
      "parameters": {},
      "id": "8fbc1d24-f967-4844-a3da-ddf894021b9c",
      "name": "Find existing Asana task",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 2,
      "position": [
        560,
        260
      ]
    },
    {
      "parameters": {},
      "id": "f4dccdb9-07b7-4a37-9b10-8d4501e7ee16",
      "name": "Create or update task",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 2,
      "position": [
        840,
        260
      ]
    },
    {
      "parameters": {},
      "id": "ce37711c-b7e8-45e2-818a-89173eccb8e1",
      "name": "Post task comment",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 2,
      "position": [
        1120,
        260
      ]
    },
    {
      "parameters": {},
      "id": "3e9d56b3-1764-4083-9b54-523447576fb2",
      "name": "Respond",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 2,
      "position": [
        1400,
        260
      ]
    }
  ],
  "connections": {
    "Webhook task event": {
      "main": [
        [
          {
            "node": "Normalize Asana fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Asana fields": {
      "main": [
        [
          {
            "node": "Find existing Asana task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find existing Asana task": {
      "main": [
        [
          {
            "node": "Create or update task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create or update task": {
      "main": [
        [
          {
            "node": "Post task comment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post task comment": {
      "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": "626d809a-8ece-4ff7-8c10-0302678ab2d0",
  "meta": {
    "templateCredsSetupCompleted": false
  }
}