{
  "name": "TMPLVISION - Word proposal to PDF",
  "nodes": [
    {
      "id": "manual-start",
      "name": "Run example",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        240,
        300
      ],
      "parameters": {}
    },
    {
      "id": "example-data",
      "name": "Proposal data",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        480,
        300
      ],
      "parameters": {
        "jsCode": "// Replace the template ID after uploading proposal-template.docx.\nconst templateId = \"YOUR_TEMPLATE_ID\";\nif (templateId === \"YOUR_TEMPLATE_ID\") throw new Error(\"Set your TMPLVISION template ID in this node first.\");\nreturn [{ json: { templateId, variables: {\n  \"reference\": \"NP-2026-014\",\n  \"issued\": \"24 October 2026\",\n  \"validUntil\": \"23 November 2026\",\n  \"company\": \"Maple & Moss Studio\",\n  \"contact\": \"Alex Morgan\",\n  \"project\": \"Client onboarding automation\",\n  \"summary\": \"Connect your enquiry form to your CRM and generate a consistent PDF proposal for each qualified enquiry.\",\n  \"items\": [\n    {\n      \"description\": \"Workflow discovery and field mapping\",\n      \"qty\": 1,\n      \"rate\": \"€480.00\",\n      \"amount\": \"€480.00\"\n    },\n    {\n      \"description\": \"Form and CRM integration\",\n      \"qty\": 2,\n      \"rate\": \"€720.00\",\n      \"amount\": \"€1,440.00\"\n    },\n    {\n      \"description\": \"Proposal template and handover\",\n      \"qty\": 1,\n      \"rate\": \"€680.00\",\n      \"amount\": \"€680.00\"\n    }\n  ],\n  \"total\": \"€2,600.00\",\n  \"delivery\": \"10 working days after access and final copy are supplied.\",\n  \"support\": true,\n  \"supportFee\": \"€120.00\"\n} } }];"
      }
    },
    {
      "id": "generate-pdf",
      "name": "Generate proposal PDF",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        740,
        300
      ],
      "parameters": {
        "method": "POST",
        "url": "https://eu.api.tmplvision.io/v1/generation/pdf",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "contentType": "multipart-form-data",
        "bodyParameters": {
          "parameters": [
            {
              "parameterType": "formData",
              "name": "data",
              "value": "={{ JSON.stringify({ templateId: $json.templateId, variables: $json.variables }) }}"
            }
          ]
        },
        "options": {
          "timeout": 120000,
          "response": {
            "response": {
              "responseFormat": "file",
              "outputPropertyName": "data"
            }
          }
        }
      },
      "notesInFlow": true,
      "notes": "Select a Header Auth credential: name x-apitoken, value your TMPLVISION API token. For a US account, change eu.api to us.api. The PDF is returned in binary field data."
    }
  ],
  "connections": {
    "Run example": {
      "main": [
        [
          {
            "node": "Proposal data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Proposal data": {
      "main": [
        [
          {
            "node": "Generate proposal PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "active": false,
  "pinData": {},
  "tags": []
}
