{
  "name": "Claude Agent Done → Discord",
  "nodes": [
    {
      "parameters": {
        "path": "claude-agent-done",
        "responseMode": "immediatelyReturnWith200",
        "options": {}
      },
      "id": "webhook-trigger",
      "name": "Claude Agent Done",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [0, 0],
      "webhookId": "claude-agent-done"
    },
    {
      "parameters": {
        "jsCode": "const data = $input.first().json;\nconst sessionId = data.session_id || '';\nconst agentName = data.subagent_name || (sessionId ? sessionId.substring(0, 8) : 'a subagent');\nreturn [{\n  json: {\n    content: `🏁 Claude agent **${agentName}** has finished.`\n  }\n}];"
      },
      "id": "build-message",
      "name": "Build Discord Message",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [220, 0]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $vars.DISCORD_CLAUDE_ALERTS_WEBHOOK }}",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ content: $json.content }) }}",
        "options": {}
      },
      "id": "discord-post",
      "name": "Post to Discord",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [440, 0]
    }
  ],
  "connections": {
    "Claude Agent Done": {
      "main": [
        [
          {
            "node": "Build Discord Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Discord Message": {
      "main": [
        [
          {
            "node": "Post to Discord",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "tags": [
    {
      "name": "claude-code"
    },
    {
      "name": "notifications"
    },
    {
      "name": "discord"
    }
  ],
  "triggerCount": 1,
  "pinData": {}
}
