{
  "id": "wpKKWZ8FEIEcVszj",
  "name": "AI lead generation: find companies or decision-makers matching your ICP (Agent Jesse)",
  "tags": [],
  "nodes": [
    {
      "id": "dd130fd6-b903-40ac-b3ec-f41e80d5570b",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -1184,
        272
      ],
      "parameters": {
        "options": {
          "customCss": ":root {\n\t--font-family: 'Open Sans', sans-serif;\n\t--font-weight-normal: 400;\n\t--font-weight-bold: 600;\n\t--font-size-body: 12px;\n\t--font-size-label: 14px;\n\t--font-size-test-notice: 12px;\n\t--font-size-input: 14px;\n\t--font-size-header: 20px;\n\t--font-size-paragraph: 14px;\n\t--font-size-link: 12px;\n\t--font-size-error: 12px;\n\t--font-size-html-h1: 28px;\n\t--font-size-html-h2: 20px;\n\t--font-size-html-h3: 16px;\n\t--font-size-html-h4: 14px;\n\t--font-size-html-h5: 12px;\n\t--font-size-html-h6: 10px;\n\t--font-size-subheader: 14px;\n\n\t/* Colors */\n\t--color-background: #fbfcfe;\n\t--color-test-notice-text: #e6a23d;\n\t--color-test-notice-bg: #fefaf6;\n\t--color-test-notice-border: #f6dcb7;\n\t--color-card-bg: #ffffff;\n\t--color-card-border: #dbdfe7;\n\t--color-card-shadow: rgba(99, 77, 255, 0.06);\n\t--color-link: #7e8186;\n\t--color-header: #525356;\n\t--color-label: #555555;\n\t--color-input-border: #dbdfe7;\n\t--color-input-text: #71747A;\n\t--color-focus-border: rgb(90, 76, 194);\n\t--color-submit-btn-bg: #ff6d5a;\n\t--color-submit-btn-text: #ffffff;\n\t--color-error: #ea1f30;\n\t--color-required: #ff6d5a;\n\t--color-clear-button-bg: #7e8186;\n\t--color-html-text: #555;\n\t--color-html-link: #ff6d5a;\n\t--color-header-subtext: #7e8186;\n\n\t/* Border Radii */\n\t--border-radius-card: 8px;\n\t--border-radius-input: 6px;\n\t--border-radius-clear-btn: 50%;\n\t--card-border-radius: 8px;\n\n\t/* Spacing */\n\t--padding-container-top: 24px;\n\t--padding-card: 24px;\n\t--padding-test-notice-vertical: 12px;\n\t--padding-test-notice-horizontal: 24px;\n\t--margin-bottom-card: 16px;\n\t--padding-form-input: 12px;\n\t--card-padding: 24px;\n\t--card-margin-bottom: 16px;\n\n\t/* Dimensions */\n\t--container-width: 448px;\n\t--submit-btn-height: 48px;\n\t--checkbox-size: 18px;\n\n\t/* Others */\n\t--box-shadow-card: 0px 4px 16px 0px var(--color-card-shadow);\n\t--opacity-placeholder: 0.5;\n}\ntextarea {\n    min-height: 110px;\n} "
        },
        "formTitle": "Jesse Lead Search",
        "formFields": {
          "values": [
            {
              "fieldType": "dropdown",
              "fieldLabel": "Search Type",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Companies"
                  },
                  {
                    "option": "People"
                  }
                ]
              },
              "requiredField": true
            },
            {
              "fieldLabel": "Company URL",
              "placeholder": "https://yourcompany.com",
              "requiredField": true
            },
            {
              "fieldType": "textarea",
              "fieldLabel": "Product Description",
              "placeholder": "What does your company do? e.g. AI-powered video editing for marketing teams",
              "requiredField": true
            },
            {
              "fieldType": "textarea",
              "fieldLabel": "ICP Description",
              "placeholder": "={{ 'For Company Search: \"B2B SaaS companies ($10M-$50M ARR) that recently raised Series B\"\\nFor People Search: \"Founders of early-stage AI startups in the US\"' }}",
              "requiredField": true
            },
            {
              "fieldType": "dropdown",
              "fieldLabel": "Number of Prospects",
              "fieldOptions": {
                "values": [
                  {
                    "option": "25"
                  },
                  {
                    "option": "50"
                  },
                  {
                    "option": "100"
                  },
                  {
                    "option": "150"
                  },
                  {
                    "option": "200"
                  },
                  {
                    "option": "250"
                  },
                  {
                    "option": "300"
                  },
                  {
                    "option": "350"
                  },
                  {
                    "option": "400"
                  },
                  {
                    "option": "450"
                  },
                  {
                    "option": "500"
                  }
                ]
              },
              "requiredField": true
            }
          ]
        },
        "formDescription": "Find companies or people matching your ICP: results land in your Jesse dashboard"
      },
      "typeVersion": 2.5
    },
    {
      "id": "9649fe18-fc95-4d5d-b034-0ba3ea306b58",
      "name": "Normalize",
      "type": "n8n-nodes-base.set",
      "position": [
        -960,
        272
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "060770c5-83e1-4c9e-9496-7f72c0896af6",
              "name": "entity",
              "type": "string",
              "value": "={{ $json['Search Type'] === 'People' ? 'people-search' : 'icp-search' }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "dc54ab2c-dd09-4779-b1bc-ae5cd2ce8ff4",
      "name": "Create search",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -736,
        272
      ],
      "parameters": {
        "url": "=https://agentjesse-backend.floworks.ai/api/v1/{{ $json.entity }}/create",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "companyUrl",
              "value": "={{ $json['Company URL'] }}"
            },
            {
              "name": "productDescription",
              "value": "={{ $json['Product Description'] }}"
            }
          ]
        },
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.4
    },
    {
      "id": "17514d9b-db81-4f57-8343-0ab5cb4b9247",
      "name": "Start research",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -512,
        272
      ],
      "parameters": {
        "url": "=https://agentjesse-backend.floworks.ai/api/v1/{{ $('Normalize').first().json.entity }}/research",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "searchId",
              "value": "={{ $json.searchId }}"
            },
            {
              "name": "icpDescription",
              "value": "={{ $('Normalize').first().json['ICP Description'] }}"
            },
            {
              "name": "numProspects",
              "value": "={{ $('Normalize').first().json['Number of Prospects'] }}"
            }
          ]
        },
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.4
    },
    {
      "id": "2aed5454-478e-44f6-b442-7a942d93b4ec",
      "name": "Wait 30s",
      "type": "n8n-nodes-base.wait",
      "position": [
        -288,
        272
      ],
      "parameters": {
        "amount": 30
      },
      "typeVersion": 1.1
    },
    {
      "id": "991ca761-e73e-4146-86ef-cb42132d7b61",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        160,
        272
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "fcab8ecb-f69b-4062-adc9-2e4de62fc843",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ [\"pending\",\"processing\"].includes($json.status) && $runIndex < 360 }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "0ca17dbe-a528-4f94-bd21-c27db5a2e48d",
      "name": "Poll status",
      "type": "n8n-nodes-base.httpRequest",
      "maxTries": 3,
      "position": [
        -64,
        208
      ],
      "parameters": {
        "url": "=https://agentjesse-backend.floworks.ai/api/v1/{{ $('Normalize').first().json.entity }}/research/{{ $json.searchId }}?page=1&limit=25",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.4,
      "waitBetweenTries": 5000
    },
    {
      "id": "c6e106db-9773-4764-9ca7-96dab006b3d0",
      "name": "Stop and Error",
      "type": "n8n-nodes-base.stopAndError",
      "position": [
        544,
        64
      ],
      "parameters": {
        "errorMessage": "Search failed or timed out (3h cap) \u2014 check your Jesse dashboard"
      },
      "typeVersion": 1
    },
    {
      "id": "df532646-9142-4687-a212-3a6bcee5eb79",
      "name": "Failed or timed out?",
      "type": "n8n-nodes-base.if",
      "position": [
        384,
        272
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "c55e94b0-e3ea-49f7-a11d-8bc2025d9e45",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.status === \"failed\" || [\"pending\",\"processing\"].includes($json.status) }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "7a9a6bf1-e550-4502-8b74-a230bf6b7fd4",
      "name": "Build page list",
      "type": "n8n-nodes-base.code",
      "position": [
        768,
        288
      ],
      "parameters": {
        "jsCode": "const totalPages = $json.pagination?.totalPages || 1;\nconst out = [];\nfor (let p = 1; p <= totalPages; p++) out.push({ json: { page: p } });\nreturn out;"
      },
      "typeVersion": 2
    },
    {
      "id": "8dd3eaca-874f-4425-b767-6fbb95613ec4",
      "name": "Fetch page",
      "type": "n8n-nodes-base.httpRequest",
      "maxTries": 3,
      "position": [
        992,
        288
      ],
      "parameters": {
        "url": "=https://agentjesse-backend.floworks.ai/api/v1/{{ $('Normalize').first().json.entity }}/research/{{ $('Poll status').first().json.searchId }}?page={{ $json.page }}&limit=25",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.4,
      "waitBetweenTries": 5000
    },
    {
      "id": "1221ca7f-7984-406d-acf5-a728be6241bd",
      "name": "Merge results",
      "type": "n8n-nodes-base.code",
      "position": [
        1216,
        288
      ],
      "parameters": {
        "jsCode": "const entity = $('Normalize').first().json.entity;\nconst key = entity === 'people-search' ? 'people' : 'companies';\nconst rows = [];\nfor (const item of $input.all()) rows.push(...(item.json[key] || []));\n\nif (key === 'people') {\n  return rows.map(p => ({ json: {\n      name: p.full_name, title: p.title, company: p.company_name,\n      company_website: p.company_website || 'N/A', industry: p.company_industry || 'N/A',\n      location: p.location || 'N/A', linkedin: p.linkedin_url || 'N/A',\n      source: p.source, relevance_score: p.relevance_score, rationale: p.rationale,\n    }}));\n}\nreturn rows.map(c => ({ json: {\n    company_name: c.company_name, website: c.website, industry: c.industry || 'N/A',\n    employees: c.employee_count || 'N/A', location: c.location || 'N/A',\n    source: c.source, relevance_score: c.relevance_score, rationale: c.rationale,\n  }}));\n"
      },
      "typeVersion": 2
    },
    {
      "id": "bb7c775a-520d-4531-a274-6788aa45efa6",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -848,
        -928
      ],
      "parameters": {
        "width": 2000,
        "height": 832,
        "content": "# AI lead generation: find companies or decision-makers matching your ICP (Agent Jesse)\n\n  **Who's it for:** sales & growth teams who want ICP-matched leads on autopilot.\n\n  **What it does:** submit the form (your product + ideal customer profile) and\n  Agent Jesse researches the live web, returning scored companies OR named\n  decision-makers with evidence-based rationales, delivered as workflow output\n  plus a CSV. Results also land in your Agent Jesse dashboard.\n\n  **How it works:**\n  1. Form collects search type, product, ICP and volume\n  2. Creates and starts an async Agent Jesse research job\n  3. Polls every 30s until complete (3h safety cap)\n  4. Fetches all result pages, merges them and converts to CSV\n\n  **Setup (2 min):**                                                                                                                                                                                              \n  1. Get your API key: https://agentjesse.floworks.ai/settings/api-keys (copy it now, it is shown only once)\n  2. Create a credential: paste your Agent Jesse API key (just the key, no \"Bearer\")\n  3. n8n applies it to all 4 HTTP nodes during template setup\n  4. Save, open the form, run your first search\n\n  Note: searches bill the key owner's Agent Jesse credits (10 per result found)."
      },
      "typeVersion": 1
    },
    {
      "id": "b18fe4bb-d159-4357-9025-ebd4a6b5a349",
      "name": "CSV",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        1440,
        288
      ],
      "parameters": {
        "options": {
          "fileName": "={{ 'agent-jesse-' + ($('Normalize').first().json.entity === 'people-search' ? 'people' : 'companies') + '-' + $now.toFormat(\"yyyy-MM-dd-HH'h'mm\") + '.csv' }}"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "cd65f1ce-7c01-4b1c-9adc-c83e3bad6278",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1232,
        16
      ],
      "parameters": {
        "color": 5,
        "width": 384,
        "height": 512,
        "content": "## 1. Search setup"
      },
      "typeVersion": 1
    },
    {
      "id": "bbfbe7de-f94c-4852-bc15-f032818cfacf",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -768,
        16
      ],
      "parameters": {
        "color": "#E2B26E",
        "width": 1408,
        "height": 512,
        "content": "## 2. Run & poll Agent Jesse research"
      },
      "typeVersion": 1
    },
    {
      "id": "552ae79a-230c-4dea-90fb-560fc9baadfa",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        688,
        16
      ],
      "parameters": {
        "color": 4,
        "width": 976,
        "height": 512,
        "content": "## 3. Collect results"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "4fba488f-56e3-4373-9121-af5c6bc28670",
  "nodeGroups": [],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Wait 30s",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Failed or timed out?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 30s": {
      "main": [
        [
          {
            "node": "Poll status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize": {
      "main": [
        [
          {
            "node": "Create search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch page": {
      "main": [
        [
          {
            "node": "Merge results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Poll status": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create search": {
      "main": [
        [
          {
            "node": "Start research",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge results": {
      "main": [
        [
          {
            "node": "CSV",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start research": {
      "main": [
        [
          {
            "node": "Wait 30s",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build page list": {
      "main": [
        [
          {
            "node": "Fetch page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Normalize",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Failed or timed out?": {
      "main": [
        [
          {
            "node": "Stop and Error",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Build page list",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}