{
  "nodes": [
    {
      "id": "527c6762-da17-4bed-ad3c-00a6e6a1c44a",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        160,
        0
      ],
      "parameters": {
        "path": "ai-proposal",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2.1
    },
    {
      "id": "5ca04c3b-037d-4fe5-bb6a-9b2b170ff4df",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        528,
        0
      ],
      "parameters": {
        "text": "=Here's the information about the customer I want you to use to generate the expected output:\n{{ $json.available_data }}",
        "options": {
          "systemMessage": "=You are a sales proposal assistant. Your job is to analyze meeting transcripts and extract structured data for generating professional proposals.\n\n## INPUT\n\nYou will receive:\n\n1. A meeting transcript or notes\n2. Client information (company name, contact details)\n3. The proposal template schema\n\n## YOUR TASK\n\nExtract and structure the following information from the transcript:\n\n1. **Client Challenges** (array)\n    - Title: Short name for the challenge\n    - Description: 1-2 sentences explaining the problem\n    - Impact: Business impact if not solved\n2. **Proposed Solutions** (array)\n    - Title: Solution name\n    - Description: How it solves the challenge\n    - Outcome: Expected result\n    - Timeline: Implementation time\n3. **Pricing** (array)\n    - Item: What's being charged\n    - Description: One-time or recurring\n    - Price: Dollar amount\n4. **Executive Summary**: 2-3 sentences summarizing the proposal\n5. **Next Steps** (array): Actionable items to move forward\n\n## OUTPUT FORMAT\n\nReturn ONLY valid JSON matching this schema. No markdown, no explanation, just JSON.\n\n{ ... insert your variable schema here }\n\n\n## RULES\n\n- If information is missing, make reasonable assumptions based on context\n- Keep language professional but conversational\n- Format prices consistently ($X,XXX)\n- Limit challenges and solutions to 3 items max\n- Be specific with outcomes (use numbers when possible)"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3.1
    },
    {
      "id": "4808ebe4-875d-44c3-8d4f-e077934300ce",
      "name": "Anthropic Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        528,
        208
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-sonnet-4-5-20250929",
          "cachedResultName": "Claude Sonnet 4.5"
        },
        "options": {}
      },
      "credentials": {
        "anthropicApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "1cbe35bb-6f2e-468d-81b8-6fa3accb8d11",
      "name": "Generate PDF syncronously",
      "type": "n8n-nodes-pdforge.pdforge",
      "position": [
        880,
        0
      ],
      "parameters": {
        "options": {},
        "variables": "={{ JSON.stringify($json.output) }}",
        "templateId": "7f22f51f23"
      },
      "credentials": {
        "pdforgeApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f025da41-9037-41c2-bef2-fd66929a3d1a",
      "name": "Send a message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1312,
        0
      ],
      "parameters": {
        "sendTo": "={{ $('Fields Mapping').first().json.email }}",
        "message": "=Hey {{ $('Fields Mapping').first().json.name.split(\" \")[0] }},\n\nGreat chatting with you earlier! I was excited enough about what we discussed that I went ahead and put a proposal together right away.\n\nI've attached it as a PDF. Take a look when it works for you and let me know if anything needs adjusting.\n\nI've also sent an invoice your way so everything's ready to go whenever you are. Feel free to reach out with any questions at all.\n\nLooking forward to it!\n[YOUR NAME]",
        "options": {
          "attachmentsUi": {
            "attachmentsBinary": [
              {}
            ]
          }
        },
        "subject": "=[Your Company] Proposal for {{ $('Fields Mapping').first().json.company }}",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f675fcd3-be4e-4dd6-9634-e58446490952",
      "name": "Download PDF binary",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1088,
        0
      ],
      "parameters": {
        "url": "={{ $json.signedUrl }}",
        "options": {}
      },
      "typeVersion": 4.3
    },
    {
      "id": "dab20f7b-f3e6-4504-9ad0-105410c2af76",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -304,
        -48
      ],
      "parameters": {
        "width": 420,
        "height": 520,
        "content": "## Welcome to Generate Custom Proposal with AI Workflow!\n\n**This workflow has the following sequence:**\n1. Webhook trigger (connected to your CRM)\n2. Map all the fields we're going to need on the workflow\n3. Transforming customer data and transcription into a formatted output\n4. Transform it into a custom PDF proposal using pdf noodle\n5. Sending the proposal through e-mail (You can change this nome to send using other formats as well)\n\n\n**The following accesses are required for the workflow:**\n- pdf noodle account: [Create here](https://app.pdfnoodle.com/auth/sign-up)\n- AI API access (e.g. via OpenAI, Anthropic, Google or Ollama)\n- Google OAuth2 Connected (with gmail permission): [Documentation](https://docs.n8n.io/integrations/builtin/credentials/google/oauth-generic/)\n\n\nYou can contact me via LinkedIn, if you have any questions: https://www.linkedin.com/in/marceloamiranda"
      },
      "typeVersion": 1
    },
    {
      "id": "1d290060-5a97-4fee-926a-8557dc86e264",
      "name": "Fields Mapping",
      "type": "n8n-nodes-base.set",
      "position": [
        352,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "859f83d3-b5d6-43f4-ad8c-75141c2e5ac2",
              "name": "name",
              "type": "string",
              "value": "={{ $json.contactName }}"
            },
            {
              "id": "60ca634b-50a8-482e-af61-13a27614dca2",
              "name": "email",
              "type": "string",
              "value": "={{ $json.contactEmail }}"
            },
            {
              "id": "6e9e3601-ddd6-459f-9b45-980715c03690",
              "name": "company",
              "type": "string",
              "value": "={{ $json.clientCompanyName }}"
            },
            {
              "id": "2e302549-006e-480c-9df3-372d30b01c95",
              "name": "available_data",
              "type": "string",
              "value": "={{ JSON.stringify($json) }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "5366041f-a700-45b8-981c-767c616e925f",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        704,
        208
      ],
      "parameters": {
        "jsonSchemaExample": "{ ... insert your variable schema here }"
      },
      "typeVersion": 1.3
    },
    {
      "id": "c7a5699e-dbc5-4ce8-b0ab-6862863c6759",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        144,
        -80
      ],
      "parameters": {
        "color": 7,
        "width": 336,
        "height": 256,
        "content": "### 1. Receiving and mapping data from CRM"
      },
      "typeVersion": 1
    },
    {
      "id": "58455044-2427-4d73-bc5f-1d153e7e5c35",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        944,
        -672
      ],
      "parameters": {
        "color": 6,
        "width": 768,
        "height": 448,
        "content": "@[youtube](yRlHu5yvuSA)"
      },
      "typeVersion": 1
    },
    {
      "id": "1f4c3021-32b8-42c3-ba57-02c04469983f",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        -80
      ],
      "parameters": {
        "color": 7,
        "width": 336,
        "height": 448,
        "content": "### 2. AI Agents formatting the data into the expected format for the PDF generation"
      },
      "typeVersion": 1
    },
    {
      "id": "225d9005-ad06-48c0-af33-ce1d2fb449bf",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        864,
        -80
      ],
      "parameters": {
        "color": 7,
        "width": 368,
        "height": 272,
        "content": "### 3. Generating and downloading the PDF of the proposal"
      },
      "typeVersion": 1
    },
    {
      "id": "d435b77f-953f-4105-95c4-9d3863dc081e",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1248,
        -80
      ],
      "parameters": {
        "color": 7,
        "height": 272,
        "content": "### 4. Sending an e-mail to the prospect with the PDF Proposal attached to it"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Fields Mapping",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Generate PDF syncronously",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fields Mapping": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download PDF binary": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Anthropic Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Generate PDF syncronously": {
      "main": [
        [
          {
            "node": "Download PDF binary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}