{
  "name": "OmniProject \u2014 Asana",
  "meta": {
    "templateId": "omniproject-asana",
    "description": "Generated OmniProject contract workflow for Asana. Set env: ASANA_WORKSPACE_ID."
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "omniproject",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "aaaaaaaa-0000-4000-8000-000000000000",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        -520,
        320
      ],
      "notes": "POST body { action, payload, source, origin, idempotencyKey }."
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "leftValue": "={{ $json.body.verify }}",
              "rightValue": true,
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ]
        },
        "options": {}
      },
      "id": "aaaaaaaa-0000-4000-8000-000000000001",
      "name": "Verify probe?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        -320,
        320
      ],
      "notes": "When the gateway's workflow verifier sends { verify: true }, short-circuit with a no-op acknowledgement so verification never touches the backend."
    },
    {
      "parameters": {
        "jsCode": "// No-op acknowledgement for the OmniProject workflow verifier.\nconst body = $('Webhook').first().json.body;\nconst caps = {\"issues\":true,\"scheduling\":true,\"portfolio\":false,\"resources\":false,\"financials\":false,\"baseline\":false,\"blockers\":false,\"history\":false,\"raid\":false};\nreturn [{ json: { success: true, data: { action: body.action, verified: true, backend: \"asana\", capabilities: caps }, message: 'verify ok' } }];"
      },
      "id": "aaaaaaaa-0000-4000-8000-000000000002",
      "name": "Verify ACK",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -120,
        140
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "leftValue": "={{ $json.body.origin }}",
              "rightValue": "={{ $json.body.payload && $json.body.payload.lastUpdatedBy }}",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              }
            }
          ]
        },
        "options": {}
      },
      "id": "aaaaaaaa-0000-4000-8000-000000000003",
      "name": "Drop loop?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        -120,
        460
      ],
      "notes": "Loop guard: drop echoes where origin === payload.lastUpdatedBy (best-effort; the gateway idempotency key is the primary dedupe)."
    },
    {
      "parameters": {
        "jsCode": "return [{ json: { success: true, data: { dropped: true }, message: 'Loop mutation dropped' } }];"
      },
      "id": "aaaaaaaa-0000-4000-8000-000000000004",
      "name": "Drop (loop)",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        120,
        620
      ]
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "leftValue": "={{ $json.body.action }}",
                    "rightValue": "list_projects",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ]
              },
              "renameOutput": true,
              "outputKey": "list_projects"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "leftValue": "={{ $json.body.action }}",
                    "rightValue": "list_issues",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ]
              },
              "renameOutput": true,
              "outputKey": "list_issues"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "leftValue": "={{ $json.body.action }}",
                    "rightValue": "create_issue",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ]
              },
              "renameOutput": true,
              "outputKey": "create_issue"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "leftValue": "={{ $json.body.action }}",
                    "rightValue": "update_issue",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ]
              },
              "renameOutput": true,
              "outputKey": "update_issue"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "leftValue": "={{ $json.body.action }}",
                    "rightValue": "delete_issue",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ]
              },
              "renameOutput": true,
              "outputKey": "delete_issue"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "leftValue": "={{ $json.body.action }}",
                    "rightValue": "get_capabilities",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ]
              },
              "renameOutput": true,
              "outputKey": "get_capabilities"
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra"
        }
      },
      "id": "aaaaaaaa-0000-4000-8000-000000000005",
      "name": "Route Action",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3,
      "position": [
        120,
        320
      ]
    },
    {
      "parameters": {
        "jsCode": "// Normalize the backend response to { success, data, message }.\nconst action = $('Webhook').first().json.body.action;\nconst rows = items.map((i) => i.json);\nconst data = rows.length === 1 ? rows[0] : rows;\nreturn [{ json: { success: true, data, message: action + ' ok' } }];"
      },
      "id": "aaaaaaaa-0000-4000-8000-000000000006",
      "name": "Normalize \u2192 N8nActionResult",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        620,
        320
      ]
    },
    {
      "parameters": {
        "jsCode": "const action = $('Webhook').first().json.body.action;\nreturn [{ json: { success: false, data: {}, message: 'Unsupported action: ' + action } }];"
      },
      "id": "aaaaaaaa-0000-4000-8000-000000000007",
      "name": "Unsupported Action",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        620,
        560
      ]
    },
    {
      "parameters": {
        "respondWith": "firstIncomingItem",
        "options": {}
      },
      "id": "aaaaaaaa-0000-4000-8000-000000000008",
      "name": "Respond",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        880,
        320
      ]
    },
    {
      "parameters": {
        "resource": "project",
        "operation": "getAll",
        "returnAll": true,
        "workspace": "={{ $env.ASANA_WORKSPACE_ID }}"
      },
      "id": "aaaaaaaa-0000-4000-8000-000000000009",
      "name": "List Projects",
      "type": "n8n-nodes-base.asana",
      "typeVersion": 1,
      "position": [
        380,
        80
      ],
      "credentials": {
        "asanaApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "task",
        "operation": "getAll",
        "returnAll": true,
        "filters": {
          "project": "={{ $json.body.payload.projectId }}"
        }
      },
      "id": "aaaaaaaa-0000-4000-8000-00000000000a",
      "name": "List Issues",
      "type": "n8n-nodes-base.asana",
      "typeVersion": 1,
      "position": [
        380,
        260
      ],
      "credentials": {
        "asanaApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "task",
        "operation": "create",
        "name": "={{ $json.body.payload.title }}",
        "otherProperties": {
          "projects": "={{ [$json.body.payload.projectId] }}",
          "notes": "={{ $json.body.payload.description }}"
        }
      },
      "id": "aaaaaaaa-0000-4000-8000-00000000000b",
      "name": "Create Issue",
      "type": "n8n-nodes-base.asana",
      "typeVersion": 1,
      "position": [
        380,
        440
      ],
      "credentials": {
        "asanaApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "task",
        "operation": "update",
        "id": "={{ $json.body.payload.issueId }}",
        "otherProperties": {
          "name": "={{ $json.body.payload.title }}"
        }
      },
      "id": "aaaaaaaa-0000-4000-8000-00000000000c",
      "name": "Update Issue",
      "type": "n8n-nodes-base.asana",
      "typeVersion": 1,
      "position": [
        380,
        620
      ],
      "credentials": {
        "asanaApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "task",
        "operation": "delete",
        "id": "={{ $json.body.payload.issueId }}"
      },
      "id": "aaaaaaaa-0000-4000-8000-00000000000d",
      "name": "Delete Issue",
      "type": "n8n-nodes-base.asana",
      "typeVersion": 1,
      "position": [
        380,
        800
      ],
      "credentials": {
        "asanaApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// Declare which domains your wired backend(s) can populate. Edit to match.\nreturn [{ json: { success: true, data: {\"issues\":true,\"scheduling\":true,\"portfolio\":false,\"resources\":false,\"financials\":false,\"baseline\":false,\"blockers\":false,\"history\":false,\"raid\":false} } }];"
      },
      "id": "aaaaaaaa-0000-4000-8000-00000000000e",
      "name": "Capabilities",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        380,
        980
      ]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Verify probe?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Verify probe?": {
      "main": [
        [
          {
            "node": "Verify ACK",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Drop loop?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Verify ACK": {
      "main": [
        [
          {
            "node": "Respond",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Drop loop?": {
      "main": [
        [
          {
            "node": "Route Action",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Drop (loop)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Drop (loop)": {
      "main": [
        [
          {
            "node": "Respond",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize \u2192 N8nActionResult": {
      "main": [
        [
          {
            "node": "Respond",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Unsupported Action": {
      "main": [
        [
          {
            "node": "Respond",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route Action": {
      "main": [
        [
          {
            "node": "List Projects",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "List Issues",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create Issue",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update Issue",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Delete Issue",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Capabilities",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Unsupported Action",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List Projects": {
      "main": [
        [
          {
            "node": "Normalize \u2192 N8nActionResult",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List Issues": {
      "main": [
        [
          {
            "node": "Normalize \u2192 N8nActionResult",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Issue": {
      "main": [
        [
          {
            "node": "Normalize \u2192 N8nActionResult",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Issue": {
      "main": [
        [
          {
            "node": "Normalize \u2192 N8nActionResult",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Delete Issue": {
      "main": [
        [
          {
            "node": "Normalize \u2192 N8nActionResult",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Capabilities": {
      "main": [
        [
          {
            "node": "Respond",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}