{
  "name": "Document Summary Workflow",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "document-summary",
        "responseMode": "onReceivedCall",
        "options": {}
      },
      "id": "webhook-trigger",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "url": "={{$json.body.document_url}}",
        "options": {
          "timeout": 30000
        }
      },
      "id": "http-fetch-doc",
      "name": "Fetch Document",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 3,
      "position": [
        450,
        300
      ]
    },
    {
      "parameters": {
        "url": "http://backend:8000/api/webhook/document-summary",
        "method": "POST",
        "bodyParameters": {
          "parameters": [
            {
              "name": "document_id",
              "value": "={{$json.document_id}}"
            },
            {
              "name": "user_id",
              "value": "={{$json.user_id}}"
            }
          ]
        },
        "options": {
          "timeout": 60000
        }
      },
      "id": "http-save-summary",
      "name": "Save Summary to DB",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 3,
      "position": [
        650,
        300
      ]
    },
    {
      "parameters": {
        "operation": "respondWith",
        "responseBody": "={{$json.message}}",
        "respondWith": "json",
        "options": {}
      },
      "id": "respond-node",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        850,
        300
      ]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Fetch Document",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Document": {
      "main": [
        [
          {
            "node": "Save Summary to DB",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Summary to DB": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {},
  "id": "document-summary-workflow"
}