{
  "name": "04 · CRM & Sales / AI Sales Proposal Generator",
  "active": false,
  "nodes": [
    {
      "id": "7e66ae20-4a81-4d98-bb76-17aeaf98d5a8",
      "name": "📘 Guide",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -640,
        -120
      ],
      "parameters": {
        "content": "## 04 · CRM & Sales · AI Sales Proposal Generator\n\n### What this does\nBuilds proposal sections from opportunity data, pricing table, and case studies; returns Doc/PDF webhook payload.\n\n### Setup checklist\n1. LLM endpoint\n2. Pricing catalog JSON\n3. Doc generator (Carbone/PDFMonkey)\n\n### How to test locally\nPOST `crm-proposal` with opportunity JSON.\n\n### Tips\n- Keep credentials in n8n Credentials (never hardcode secrets).\n- Use **Test URL** on the Webhook while developing.\n- Activate only after credentials + destinations are configured.\n",
        "width": 560,
        "height": 560,
        "color": 3
      }
    },
    {
      "id": "32fc1672-5a6b-4f66-94bb-44a5f9c22b9f",
      "name": "⚙️ Config",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -640,
        480
      ],
      "parameters": {
        "content": "## Config map\n\n- **Webhook path:** `crm-proposal`\n- **Replace** all `https://httpbin.org/...` calls with real integrations.\n- **Credentials:** create in n8n → Credentials, then select on HTTP nodes.\n- **Activate** workflow only after a successful Test execution.\n\n### Local files\nShared host folder is mounted at `/files` inside n8n.",
        "width": 560,
        "height": 320,
        "color": 2
      }
    },
    {
      "id": "dbfd6e41-94fd-49b8-a25c-64bafb8e7504",
      "name": "Webhook Trigger",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        200
      ],
      "webhookId": "793d57cc-30b3-4359-a4e3-9a5e09bcbe61",
      "parameters": {
        "httpMethod": "POST",
        "path": "crm-proposal",
        "responseMode": "responseNode",
        "options": {}
      }
    },
    {
      "id": "d3df8c0c-0aca-43ed-81ae-8bbf9cc8fea9",
      "name": "Build Prompt Context",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        280,
        200
      ],
      "parameters": {
        "mode": "manual",
        "duplicateItem": false,
        "assignments": {
          "assignments": [
            {
              "id": "1",
              "name": "system",
              "value": "You are an expert operator for: AI Sales Proposal Generator",
              "type": "string"
            },
            {
              "id": "2",
              "name": "userInput",
              "value": "={{ $json.body || $json }}",
              "type": "object"
            },
            {
              "id": "3",
              "name": "model",
              "value": "gpt-4.1-mini",
              "type": "string"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "id": "ac50ae72-db7f-4a70-8d7e-25a632f36866",
      "name": "AI Transform (swap for LLM node)",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        560,
        200
      ],
      "parameters": {
        "mode": "runOnceForAllItems",
        "language": "javaScript",
        "jsCode": "const ctx = $input.first().json;\nconst input = ctx.userInput || {};\n// Placeholder \"model\" output — replace this Code node with OpenAI/Anthropic node.\nconst draft = {\n  summary: `Generated by AI Sales Proposal Generator`,\n  bullets: Object.keys(input).slice(0, 8).map(k => `${k}: ${JSON.stringify(input[k]).slice(0,120)}`),\n  score: Math.round(60 + Math.random()*40),\n  recommendations: ['Review tone', 'Add CTA', 'Fact-check claims'],\n};\nreturn [{ json: { ...ctx, ai: draft, ready: draft.score >= 70 } }];"
      }
    },
    {
      "id": "68b3f0c2-3c50-482d-bb34-e8c486774d3a",
      "name": "Quality Gate",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        840,
        200
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "4eae543e-9701-489c-b010-af398548eaa3",
              "leftValue": "={{ $json.ready }}",
              "rightValue": true,
              "operator": {
                "type": "boolean",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "886858f8-952e-4848-a696-c35bc93ca2eb",
      "name": "Persist / Publish",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1120,
        80
      ],
      "parameters": {
        "method": "POST",
        "url": "https://httpbin.org/post",
        "options": {},
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify($json) }}"
      }
    },
    {
      "id": "2d37b399-b467-4c5d-8c52-5272b4145c15",
      "name": "Needs Human Review",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1120,
        320
      ],
      "parameters": {
        "mode": "manual",
        "duplicateItem": false,
        "assignments": {
          "assignments": [
            {
              "id": "1",
              "name": "review",
              "value": true,
              "type": "boolean"
            },
            {
              "id": "2",
              "name": "reason",
              "value": "AI quality score below threshold",
              "type": "string"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "id": "a7eacd0c-1680-4ab4-9430-7faf79bc594e",
      "name": "Webhook Response",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        1400,
        200
      ],
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ $json }}",
        "options": {}
      }
    }
  ],
  "connections": {
    "Webhook Trigger": {
      "main": [
        [
          {
            "node": "Build Prompt Context",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Prompt Context": {
      "main": [
        [
          {
            "node": "AI Transform (swap for LLM node)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Transform (swap for LLM node)": {
      "main": [
        [
          {
            "node": "Quality Gate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Quality Gate": {
      "main": [
        [
          {
            "node": "Persist / Publish",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Needs Human Review",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Persist / Publish": {
      "main": [
        [
          {
            "node": "Webhook Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Needs Human Review": {
      "main": [
        [
          {
            "node": "Webhook Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "callerPolicy": "workflowsFromSameOwner"
  },
  "tags": [],
  "meta": {
    "templateCredsSetupCompleted": true,
    "description": "Builds proposal sections from opportunity data, pricing table, and case studies; returns Doc/PDF webhook payload."
  },
  "pinData": {}
}