{
  "id": "vrJxmnlp0Cr68Xzq",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Spendict \u2014 gate every generated ad before spend",
  "tags": [],
  "nodes": [
    {
      "id": "52089f01-179d-499d-9060-7dea6eba4e08",
      "name": "When clicking 'Test workflow'",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        3216,
        976
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "957fb9a5-1227-4bb0-8ad7-9a5c252a99b0",
      "name": "The ad (replace with your generator)",
      "type": "n8n-nodes-base.set",
      "position": [
        3440,
        976
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "a1",
              "name": "headline",
              "type": "string",
              "value": "The #1 secret marketers don't want you to know"
            },
            {
              "id": "a2",
              "name": "primary_text",
              "type": "string",
              "value": "Unlock the AI advantage today! Our revolutionary platform leverages cutting-edge technology to supercharge your growth."
            },
            {
              "id": "a3",
              "name": "platform",
              "type": "string",
              "value": "meta"
            },
            {
              "id": "a4",
              "name": "product_context",
              "type": "string",
              "value": "Spendict \u2014 deterministic run/fix/kill verdicts for AI ad creative, $99/mo"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "fd5b5ad9-57dd-4dd3-8678-e0e88c2f9ccb",
      "name": "Spendict: assess_ad_creative",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3680,
        976
      ],
      "parameters": {
        "url": "https://www.spendict.com/api/v1/assess",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ JSON.stringify({ ad_copy: { headline: $json.headline, primary_text: $json.primary_text }, platform: $json.platform, product_context: $json.product_context }) }}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "typeVersion": 4.2
    },
    {
      "id": "adde2968-6741-46a0-b4f2-7e6f17ba1c1c",
      "name": "Gate on the verdict",
      "type": "n8n-nodes-base.switch",
      "position": [
        3920,
        976
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "run \u2192 ship it",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "c-run",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.launch_recommendation }}",
                    "rightValue": "run"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "fix_first \u2192 hold",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "c-fix",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.launch_recommendation }}",
                    "rightValue": "fix_first"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "526e2f2c-91de-47ad-a409-0df5459c7c79",
      "name": "Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2608,
        736
      ],
      "parameters": {
        "width": 480,
        "height": 848,
        "content": "## Gate every generated ad before spend\n\nA minimal starting point: take one ad, score it with Spendict, and branch on the verdict so only creative that clears the bar ever reaches your ad platform.\n\n### How it works\n\n1. A manual trigger fires the run \u2014 swap it for your generator, a webhook, or a queue.\n2. A Set node holds the ad copy, platform, product context and audience. Replace it with the output of whatever writes your ads.\n3. Spendict's `assess_ad_creative` scores the ad across seven dimensions and returns a deterministic verdict plus the single predicted failure mode.\n4. A Switch branches on that verdict: `run` is ready to ship, `fix_first` should have its prioritized fixes applied and be re-assessed, and `kill` should be regenerated rather than spent on.\n\n### Setup\n\n- **Spendict** \u2014 free key at spendict.com/dashboard, then Header Auth `Authorization: Bearer spd_live_\u2026` on the Spendict node.\n- Wire your ad-platform or queue node to the `run` output. Leave the other outputs unconnected until you decide how to handle them.\n\n### Customization tips\n\nReplace the manual trigger and the Set node with your own generator to run this on autopilot."
      },
      "typeVersion": 1
    },
    {
      "id": "a69e7bdc-fdde-4025-aaff-686597f3b768",
      "name": "Section: build payload",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3136,
        736
      ],
      "parameters": {
        "color": 7,
        "width": 460,
        "height": 448,
        "content": "## Build the ad payload\n\nA manual trigger and a Set node stand in for your generator. Replace them with whatever produces your ad copy."
      },
      "typeVersion": 1
    },
    {
      "id": "1689169e-01f5-4aca-9909-275f9a41153d",
      "name": "Section: score and branch",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3616,
        736
      ],
      "parameters": {
        "color": 7,
        "width": 572,
        "height": 448,
        "content": "## Score and branch\n\nSpendict scores the ad and the Switch splits it three ways \u2014 `run` ships, `fix_first` is reworked, `kill` is regenerated."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "ba0b7175-c335-4023-8e05-3342d0a1d632",
  "nodeGroups": [],
  "connections": {
    "Spendict: assess_ad_creative": {
      "main": [
        [
          {
            "node": "Gate on the verdict",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking 'Test workflow'": {
      "main": [
        [
          {
            "node": "The ad (replace with your generator)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "The ad (replace with your generator)": {
      "main": [
        [
          {
            "node": "Spendict: assess_ad_creative",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}