{
  "$schema": "../workflow-recipe.schema.json",
  "format": "revenanas.workflow-recipe/v1",
  "slug": "clay-closed-won-lookalikes-tender-signal",
  "title": "How to find closed-won lookalikes showing a live tender signal in Clay",
  "job": "Turn the reason you won deals in HubSpot into a qualified list of lookalike accounts showing the same public signal now, each with a cited official source.",
  "tools": [
    "HubSpot",
    "Clay",
    "Perplexity"
  ],
  "service": {
    "name": "Signal-Based Outbound",
    "url": "https://www.revenanas.com/services/signal-based-outbound"
  },
  "importability": {
    "clay": "official-cli-bundle",
    "template_url": null,
    "notes": "Built and run through Clay's official Terracotta CLI in the Revenanas test workspace, then exported as a transparent Revenanas bundle. Clay does not offer public template links for Workflows. The installer recreates the graph as an unpublished draft with official CLI commands and validates it. Workspace-specific IDs are passed with --set; HubSpot and Lemlist are connected in Clay by you. Recreated through the official CLI, not a native Clay template."
  },
  "direct_answer": "Look up closed-won HubSpot companies and their why-we-won, winning-signal and MEDDPICC fields, plus closed-lost companies as suppressions. Pass the won domains to Clay's company lookalike action. For each lookalike, retrieve official procurement evidence with Perplexity restricted to government sources, then let a Claygent return exactly Qualified, Not qualified, Unclear or Suppressed against the win reason. Write every decision to Clay Audiences by domain.",
  "inputs": [
    {
      "name": "demo_vanta_segment_status",
      "type": "string",
      "required": true,
      "description": "HubSpot company property: closed_won_seed or closed_lost_suppression. Rename to your own property."
    },
    {
      "name": "demo_vanta_why_we_won",
      "type": "string",
      "required": true,
      "description": "HubSpot company property: why the deal was won, in the customer's terms."
    },
    {
      "name": "demo_vanta_winning_signal",
      "type": "string",
      "required": true,
      "description": "HubSpot company property: one controlled signal value, e.g. public_sector_tender."
    },
    {
      "name": "demo_vanta_meddpic_summary",
      "type": "string",
      "required": false,
      "description": "HubSpot company property: MEDDPICC context used by the Claygent."
    },
    {
      "name": "demo_vanta_clay_domain",
      "type": "domain",
      "required": true,
      "description": "HubSpot company property holding the domain Clay seeds from."
    }
  ],
  "outputs": [
    {
      "name": "qualification_status",
      "type": "string",
      "required": true,
      "description": "Qualified, Not qualified, Unclear or Suppressed."
    },
    {
      "name": "signal_summary",
      "type": "string",
      "required": false,
      "description": "Buyer-safe sentence of at most 18 words, Qualified rows only."
    },
    {
      "name": "evidence_url",
      "type": "url",
      "required": false,
      "description": "Direct official procurement notice URL."
    },
    {
      "name": "contracting_authority",
      "type": "string",
      "required": false,
      "description": "Public body named in the notice."
    },
    {
      "name": "evidence_date",
      "type": "string",
      "required": false,
      "description": "Notice or award date."
    },
    {
      "name": "contract_value",
      "type": "string",
      "required": false,
      "description": "Value shown by the notice."
    },
    {
      "name": "confidence_score",
      "type": "number",
      "required": true,
      "description": "0 to 100."
    }
  ],
  "steps": [
    {
      "id": "01-won",
      "action": "Pull closed-won win context from HubSpot",
      "purpose": "Read seed domains and the three win fields at run time, not from a stale export.",
      "configuration": {
        "action": "hubspot-lookup-object",
        "filter": "segment status = closed_won_seed"
      }
    },
    {
      "id": "02-lost",
      "action": "Pull closed-lost suppressions from HubSpot",
      "purpose": "Carry lost domains through the run so they can never qualify.",
      "configuration": {
        "filter": "segment status = closed_lost_suppression"
      }
    },
    {
      "id": "03-pattern",
      "action": "Derive the win pattern",
      "purpose": "Deduplicate and join the win fields into one context block with a deterministic code step.",
      "configuration": {
        "node": "code"
      }
    },
    {
      "id": "04-lookalikes",
      "action": "Find 10 company lookalikes",
      "purpose": "Expand the seed into candidates before spending research credits.",
      "configuration": {
        "action": "find-company-lookalikes-v2",
        "limit": 10,
        "employees": "50-2000",
        "countries": 13,
        "live_domain": true
      }
    },
    {
      "id": "05-retrieve",
      "action": "Search official tender notices per lookalike",
      "purpose": "Retrieve citable evidence only from government procurement sources, with an identity header that survives no-result answers.",
      "configuration": {
        "action": "perplexity-chat-completions",
        "model": "sonar",
        "domains": [
          "find-tender.service.gov.uk",
          "contractsfinder.service.gov.uk",
          "ted.europa.eu"
        ]
      }
    },
    {
      "id": "06-decide",
      "action": "Qualify evidence against why we won with a Claygent",
      "purpose": "Judge only the retrieved evidence; split buyer-safe copy from internal fields.",
      "configuration": {
        "node": "agent",
        "statuses": [
          "Qualified",
          "Not qualified",
          "Unclear",
          "Suppressed"
        ]
      }
    },
    {
      "id": "07-persist",
      "action": "Upsert every decision to Clay Audiences",
      "purpose": "Keep rejected accounts and reasons, not just winners.",
      "configuration": {
        "action": "upsert-audiences-record",
        "lookup": "domain",
        "fields": 10
      }
    }
  ],
  "guardrails": [
    "Suppressed domains are decided before any evidence is considered.",
    "Qualified requires a direct official notice naming the exact company as supplier; ambiguous identity returns Unclear.",
    "Check the supplier party on every cited notice before quoting it: resellers can appear on notices that name another vendor's product.",
    "signal_summary never contains authority, value, source, CRM or qualification language.",
    "After resets, check Audiences record counts for duplicates before activation reads the segment."
  ],
  "test_cases": [
    {
      "name": "End-to-end discovery",
      "input": {
        "seed_accounts": 5,
        "suppressions": 2
      },
      "expected_status": "10 lookalikes researched, decisions written to Audiences",
      "observed": "passed"
    },
    {
      "name": "Fresh-reset discovery",
      "input": {
        "qualified_records_before_run": 0
      },
      "expected_status": "same qualified accounts return with fresh citations",
      "observed": "passed"
    }
  ],
  "architecture": {
    "summary": "A manual trigger feeds two HubSpot lookups and one deterministic code step, a Clay lookalike search, then Perplexity retrieval and a Claygent decision run once per lookalike, ending in an Audiences upsert.",
    "diagram": "Manual -> HubSpot closed-won lookup -> HubSpot closed-lost lookup -> Derive win pattern -> Find 10 lookalikes -> Perplexity per lookalike -> Claygent per lookalike -> Upsert to Clay Audiences"
  },
  "verification": {
    "last_tested": "2026-09-23",
    "builder": "Clay official Terracotta CLI",
    "graph_valid": true,
    "passing_tests": 2,
    "passing_run_ids": [
      "wfr_0tltj9vvkzV6QAFfY2N",
      "wfr_0tltnxfsfeWrAERcScm"
    ],
    "install_check": "2026-09-25: bundle installed as an unpublished draft (wf_0tlx7goURVqdv2uEi7q); graph valid; node and edge structure identical to the live workflow.",
    "observed_failures": [
      "The workspace account-agent tool had no internet retrieval, so retrieval (Perplexity) and decision (Claygent) are separate steps.",
      "An early prototype hard-coded tender evidence in a code step; its output looked correct. Only reading the graph caught it.",
      "The Claygent can qualify a notice where a reseller, not the named product's vendor, is the supplier of record. Verify the supplier party before use.",
      "Graph exports are not valid node-create input: code-node output schemas and action parameter catalogs had to be normalized for the installer."
    ]
  },
  "limitations": [
    "The HubSpot data in the tested build is synthetic and uses demo_vanta_* property names; rename to your own properties.",
    "Ten Audiences company fields must exist and be passed to the installer with --set audf_*=<field id>.",
    "Retrieval covers UK and EU procurement portals only.",
    "Credits are spent per lookalike on retrieval and the Claygent; filter hard in the lookalike step."
  ],
  "faqs": [
    {
      "question": "Can Clay find lookalike companies from HubSpot closed-won deals?",
      "answer": "Yes. Look up closed-won companies with Clay's HubSpot lookup action, pass their domains to the company lookalike action, and suppress closed-lost domains before any qualification step."
    },
    {
      "question": "Why use Perplexity and a Claygent instead of one AI step?",
      "answer": "Retrieval and judgement fail in different ways. Retrieval restricted to official sources returns citable evidence, and a Claygent judging only that evidence cannot make up a source."
    },
    {
      "question": "Does this only work for tenders?",
      "answer": "No. Any win reason tied to a public, dated event you can retrieve and cite works the same way: a regulation deadline, funding, a security incident, a leadership change."
    }
  ],
  "sources": [
    {
      "name": "Clay Workflows documentation",
      "url": "https://university.clay.com/docs/workflows"
    },
    {
      "name": "Clay Workflow FAQs",
      "url": "https://university.clay.com/docs/workflow-faqs"
    },
    {
      "name": "Clay HubSpot integration overview",
      "url": "https://university.clay.com/docs/hubspot-integration-overview"
    },
    {
      "name": "Clay: enriching with Perplexity",
      "url": "https://university.clay.com/lessons/enrich-with-perplexity"
    },
    {
      "name": "Clay: building Claygents with Claygent Builder",
      "url": "https://university.clay.com/lessons/build-scale-and-deploy-claygents-with-claygent-builder"
    },
    {
      "name": "Find a Tender developer documentation",
      "url": "https://www.find-tender.service.gov.uk/Developer/Documentation"
    }
  ],
  "related_guide": "https://www.revenanas.com/blog/closed-won-signal-led-pipeline-clay",
  "install_command": "python3 install_clay_workflow.py.txt clay-closed-won-lookalikes-tender-signal.clay-workflow.json --set audf_batch=<id> --set audf_why_we_won=<id> --set audf_qualification_status=<id> --set audf_signal_type=<id> --set audf_signal_summary=<id> --set audf_evidence_url=<id> --set audf_evidence_date=<id> --set audf_contract_value=<id> --set audf_contracting_authority=<id> --set audf_confidence_score=<id>"
}