• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
project logo

templates

leads

Lead qualifying from any data source
Public
Like
leads
Home
Code
7
PROMPT.txt
README.md
agent.ts
dashboard.tsx
db.ts
H
main.ts
welcome-ui.tsx
Branches
1
Pull requests
Remixes
1
History
Environment variables
1
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
Code
/
Search
main.ts
https://templates--019b2a6075a075f489992190ccc59174.web.val.run
README.md

Leads

Lead qualifying from any data source. Use AI to stay focused on inbound leads that fit your ICP.

image.png

What this does

  1. This val accepts webhook
  2. You can POST arbitrary lead data to it from anywhere
  3. An AI agent sorts the good leads from the bad leads
  4. Leads are stored and arranged in a dashboard

Getting started

  1. Click Remix
  2. Store your OPENAI_API_KEY as an environment variable here
  3. Customize PROMPT.txt (Don't remove any fields from the structured response)
  4. Get the val's HTTP endpoint from main.ts:
  5. Forward leads to this webhook as a POST request.
  6. That's it! Watch them drop into your dashboard at main.ts

How it works

Webhook

  • The webhook receives each POST request and stores the incoming data as input_data
  • All input_data is passed to the OpenAI agent in agent.ts

AI Agent

  • The agent uses web research to evaluate if the lead is a match for the criteria in PROMPT.txt.
  • The AI returns {name, match, reasoning}. This is the output_data.

Storage

  • Every lead is added to the leads SQLite table with the columns:
    • id — auto-incremented, starts at 1
    • timestamp — unix ms when received
    • input_data — the POST body you sent (JSON)
    • output_data — AI result: {name, match, reasoning}

Dashboard

  • Leads that are a match are at the top of the dashboard.
  • Non-matches are hidden by default
  • Click a lead to view all input and output data

Options

  • Add fields to the AI's output instructions in PROMPT.txt to:
    • enhance the AI's assessment
    • enrich your leads
    • normalize lead data from different sources
  • Add query parameters to your POST to flag sources
    • ex: your-val-endpoint.val.run?source=signup-page

Data Sources

  • Forms
    • Typeform
    • Tally
    • Netlify
    • Webflow
  • Scheduling
    • Calendly
  • Chat
    • Intercom
  • Website Visitors
    • RB2B
    • Clearbit
  • CRM
    • HubSpot
  • Dev
    • GitHub
  • Automation
    • Zapier
Code
PROMPT.txtREADME.mdagent.tsdashboard.tsxdb.ts
H
main.ts
welcome-ui.tsx
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.