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

valdottown

leads

AI-powered lead qualifying from any data source
Unlisted
Like
leads
Home
Code
7
PROMPT.txt
README.md
agent.ts
dashboard.tsx
db.ts
H
main.ts
testing.ts
Branches
3
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
/
README.md
Code
/
README.md
Search
…
Viewing readonly version of simplified branch: v78
View latest version
README.md

Leads

AI-powered lead filtering from any data source.

Getting started

  1. Click Remix
  2. Save your OPENAI_API_KEY as an environment variable .
  3. Customize PROMPT.txt
  4. Copy the HTTP endpoint from main.ts: image.png
  5. Point your webhook to this val's HTTP endpoint
  6. That's it! Every new lead that is passed to this val will be stored in an SQLITE database where the REASONING column explains why the MATCH column is true or false

How it works

  • When a new lead comes in via POST, it is forwarded along with the instructions in PROMPT.txt to an OpenAI agent. The agent uses web search to research the person and determine if they represent an idealCustomer, then explains its reasoning.
  • The input data and agent results are saved in the leads sqlite table.
  • The main.ts dashboard shows a history of all leads, ideal customers first. Clicking any lead shows the agent's reasoning and all raw data from the process
  • digest.ts runs every day by default.
  • Feel free to change the timing and frequency of the digest.ts cron. It always checks when it was last run and sends every new idealCustomer to the recipients in the array.

AI output

The agent normalizes data from any source and returns a consistent schema:

  • name - Full name of the person
  • company - Company name (or null if unknown)
  • role - Job title (or null if unknown)
  • linkedinUrl - LinkedIn profile URL (or null)
  • email - Email address (or null)
  • idealCustomer - "yes", "no", or "insufficient_data"
  • reasoning - 3-5 sentences explaining the assessment

Raw data

Each lead stores a raw_data JSON blob containing:

  • input - The original payload from the webhook source
  • aiOutput - The agent's structured response
  • runData - Metadata about the run (timestamps, token usage, stop reason)

You can view this on the lead detail page by expanding the "Raw Data" section.

Options

  • digest

  • source or other params. You can add ?source=your-source-name:

  • RB2B: ?source=rb2b

  • Tally forms: ?source=tally

  • Zapier: ?source=zapier

  • Custom: ?source=anything

The AI normalizes data from any source into a consistent schema, so you don't need to worry about field mapping.

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.