{
  "id": "I7WH7YAkU7thNKGJ",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Vendor Quotation Comparator with Smart AI Summary Table",
  "tags": [],
  "nodes": [
    {
      "id": "f13d14c0-5c12-49dc-8fdc-09374c800045",
      "name": "Upload Quotes",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -480,
        -140
      ],
      "parameters": {
        "path": "vendor-quote-upload",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "3d583a32-3731-4b44-98b0-b90866128a54",
      "name": "Extract File Data",
      "type": "n8n-nodes-base.function",
      "position": [
        -260,
        -140
      ],
      "parameters": {
        "functionCode": "return items.map(item => {\n  const file = item.binary['data'];\n  return {\n    json: {\n      fileName: file.fileName,\n      fileData: file.data\n    }\n  };\n});"
      },
      "typeVersion": 1
    },
    {
      "id": "bd191a98-5b73-4732-bffa-1c9d09faadb4",
      "name": "AI Summarization",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -40,
        -140
      ],
      "parameters": {
        "url": "https://api.grok.xai.com/summarize",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "616fcc3f-2c98-4816-ad3a-5285e47322f5",
      "name": "Format Summary",
      "type": "n8n-nodes-base.function",
      "position": [
        400,
        -140
      ],
      "parameters": {
        "functionCode": "return items.map(item => {\n  const summary = item.json;\n  return {\n    json: {\n      vendor: summary.vendor || 'Unknown',\n      price: summary.price || 0,\n      deliveryTime: summary.deliveryTime || 'N/A',\n      features: summary.features || []\n    }\n  };\n});"
      },
      "typeVersion": 1
    },
    {
      "id": "e322b3b3-3b5e-4a2b-b734-6d3c2a8a7a51",
      "name": "Log to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        620,
        -140
      ],
      "parameters": {
        "range": "QuotationSummary!A:D",
        "options": {},
        "sheetId": "your-google-sheet-id",
        "operation": "append"
      },
      "credentials": {
        "googleApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "9e515cef-d701-47d3-b1a8-6b5e235ab5bf",
      "name": "Wait For Reply",
      "type": "n8n-nodes-base.wait",
      "position": [
        180,
        -140
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "6a812cc2-8d22-4e08-83af-0f0bafe66ac4",
      "name": "Send email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        840,
        -140
      ],
      "parameters": {
        "text": "json: {\n      vendor: summary.vendor || 'Unknown',\n      price: summary.price || 0,\n      deliveryTime: summary.deliveryTime || 'N/A',\n      features: summary.features || []\n    }",
        "options": {},
        "subject": "Vendor Quotation Comparison",
        "toEmail": "user@example.com",
        "fromEmail": "user@example.com",
        "emailFormat": "text"
      },
      "credentials": {
        "smtp": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "54b92d68-e46a-4af9-8fd2-c4cd16c36316",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        300,
        -560
      ],
      "parameters": {
        "color": 4,
        "width": 580,
        "height": 260,
        "content": "## Minimal Google Sheet Columns (Top 5):\n\n**Vendor Name** \u2013 Name of the vendor\n\n**Total Amount** \u2013 Final quoted price\n\n**Delivery Timeline** \u2013 Estimated delivery time\n\n**AI Summary** \u2013 Key points from the quotation\n\n**Status** \u2013 e.g., Logged, Reviewed, Selected"
      },
      "typeVersion": 1
    },
    {
      "id": "ccf6e6a7-6e08-4cc5-ada8-5e70dd688ef1",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -500,
        -740
      ],
      "parameters": {
        "width": 680,
        "height": 560,
        "content": "### \ud83e\uddf7 **Notes for Each Node:**\n1. **Upload Quotes** (Webhook Trigger)\n   \ud83d\udccc *Triggers the workflow when vendor quote files are uploaded (via webhook).*\n   \u27a4 Accepts input like PDF, Excel, or other documents.\n\n2. **Extract File Data** (Code/Function Node)\n   \ud83d\udccc *Parses and extracts key data from uploaded quote files.*\n   \u27a4 Converts file contents to structured text or JSON.\n\n3. **AI Summarization** (HTTP Request to Grok API)\n   \ud83d\udccc *Sends the extracted data to an AI model to generate a comparison summary.*\n   \u27a4 Uses Grok or another LLM to create a smart summary.\n\n4. **Wait For Reply** (Wait Node)\n   \ud83d\udccc *Waits for the AI response before proceeding.*\n   \u27a4 Ensures no step runs before the summary is ready.\n\n5. **Format Summary** (Code/Function Node)\n   \ud83d\udccc *Cleans and formats the AI response into a readable comparison table.*\n   \u27a4 Converts raw AI output into structured rows/columns.\n\n6. **Log to Google Sheets** (Google Sheets Node)\n   \ud83d\udccc *Appends the formatted summary into a Google Sheet.*\n   \u27a4 Maintains a log of all vendor comparisons for easy tracking.\n\n7. **Send Email** (Email Node)\n   \ud83d\udccc *Emails the formatted summary to stakeholders or procurement team.*\n   \u27a4 Sends decision-ready content to the right people."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "5b1389b3-0c98-4fb8-8ac1-ba2de9c736c9",
  "connections": {
    "Upload Quotes": {
      "main": [
        [
          {
            "node": "Extract File Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Summary": {
      "main": [
        [
          {
            "node": "Log to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait For Reply": {
      "main": [
        [
          {
            "node": "Format Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Summarization": {
      "main": [
        [
          {
            "node": "Wait For Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract File Data": {
      "main": [
        [
          {
            "node": "AI Summarization",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log to Google Sheets": {
      "main": [
        [
          {
            "node": "Send email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}