{
  "name": "RFP / RFQ Auto-Responder Workflow",
  "nodes": [
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "simple": false,
        "filters": {
          "labelIds": [
            "INBOX",
            "UNREAD"
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.gmailTrigger",
      "typeVersion": 1.3,
      "position": [
        120,
        240
      ],
      "id": "e47b7bc9-a9ab-4b1d-b4d1-1b99fcadc4b1",
      "name": "Gmail Trigger (New Emails)",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "value": "models/gemini-2.5-flash",
          "mode": "list",
          "cachedResultName": "models/gemini-2.5-flash"
        },
        "messages": {
          "values": [
            {
              "content": "=You are the Knowledge Manager & Researcher agent. Analyze the incoming email to determine if it is a Request for Proposal (RFP) or a Request for Quote (RFQ).\n\nIf it IS an RFP/RFQ, extract the core requirements, deadlines, and key questions being asked. If it is NOT an RFP/RFQ, simply state so.\n\nReturn only valid JSON using this exact shape:\n{\n  \"is_rfp_rfq\": true,\n  \"summary\": \"Brief summary of the request\",\n  \"requirements\": [\"Requirement 1\", \"Requirement 2\"],\n  \"deadline\": \"YYYY-MM-DD or Not specified\"\n}\n\nSubject: {{ $('Gmail Trigger (New Emails)').item.json.subject || $('Gmail Trigger (New Emails)').item.json.snippet }}\nBody: {{ $('Gmail Trigger (New Emails)').item.json.textPlain || $('Gmail Trigger (New Emails)').item.json.text }}"
            }
          ]
        },
        "jsonOutput": true,
        "simplify": false,
        "builtInTools": {},
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "typeVersion": 1.1,
      "position": [
        360,
        240
      ],
      "id": "3fb03353-8b71-4854-ab46-c8c8481b8567",
      "name": "Analyze Request (Gemini)",
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "55c1a52d-d203-4f65-b905-f1be58b516fe",
              "leftValue": "={{ $('Analyze Request (Gemini)').item.json.candidates[0].content.parts[0].text }}",
              "rightValue": "\"is_rfp_rfq\": true",
              "operator": {
                "type": "string",
                "operation": "contains"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        600,
        240
      ],
      "id": "09bb633c-f2d2-4782-857d-80fbf97274ec",
      "name": "Is RFP/RFQ?"
    },
    {
      "parameters": {
        "resource": "document",
        "operation": "create",
        "title": "=RFP Draft: {{ $('Gmail Trigger (New Emails)').item.json.subject || $('Gmail Trigger (New Emails)').item.json.snippet }}",
        "content": "=RFP / RFQ Analysis\n\nSender: {{ $('Gmail Trigger (New Emails)').item.json.from }}\nDate: {{ $('Gmail Trigger (New Emails)').item.json.date }}\n\nSummary:\n{{ JSON.parse($('Analyze Request (Gemini)').item.json.candidates[0].content.parts[0].text).summary }}\n\nRequirements:\n{{ JSON.parse($('Analyze Request (Gemini)').item.json.candidates[0].content.parts[0].text).requirements.map((requirement) => '- ' + requirement).join('\\n') }}\n\nDeadline: {{ JSON.parse($('Analyze Request (Gemini)').item.json.candidates[0].content.parts[0].text).deadline }}\n\n---\nDraft Response Section:\n[Human reviewer to finalize proposal response here]"
      },
      "type": "n8n-nodes-base.googleDocs",
      "typeVersion": 2,
      "position": [
        840,
        120
      ],
      "id": "120ad01e-96a3-4c55-ae12-c5e9d53fd16c",
      "name": "Create Google Doc"
    },
    {
      "parameters": {
        "resource": "draft",
        "operation": "create",
        "subject": "=Re: {{ $('Gmail Trigger (New Emails)').item.json.subject || $('Gmail Trigger (New Emails)').item.json.snippet }}",
        "message": "=Hello,\n\nThank you for reaching out with your request. We have created an internal draft document for our team to review before sending a final response.\n\nInternal Reference Document: https://docs.google.com/document/d/{{ $json.documentId }}/edit\n\nWe will follow up shortly.\n\nBest,\nProject NoeMI Team",
        "toEmail": "={{ $('Gmail Trigger (New Emails)').item.json.from }}",
        "options": {
          "threadId": "={{ $('Gmail Trigger (New Emails)').item.json.threadId }}"
        }
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [
        1080,
        120
      ],
      "id": "0c2e71d7-3a0a-48a3-bdb6-5ca5703561b7",
      "name": "Draft Gmail Reply",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        840,
        360
      ],
      "id": "9355548b-8f79-4865-b09f-baad7d25e2e7",
      "name": "Ignore Non-RFPs"
    }
  ],
  "connections": {
    "Gmail Trigger (New Emails)": {
      "main": [
        [
          {
            "node": "Analyze Request (Gemini)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Request (Gemini)": {
      "main": [
        [
          {
            "node": "Is RFP/RFQ?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is RFP/RFQ?": {
      "main": [
        [
          {
            "node": "Create Google Doc",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Ignore Non-RFPs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Google Doc": {
      "main": [
        [
          {
            "node": "Draft Gmail Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "availableInMCP": false
  },
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "versionId": "cbf654e6-5ad2-45cf-9430-868a72b958d6",
  "id": "rfpResponderTemplate",
  "tags": []
}