• 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
8
PROMPT.txt
README.md
agent.ts
dashboard.tsx
db.ts
C
digest.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: v15
View latest version
README.md

Leads

AI-powered lead filtering from any data source. Includes a dashboard and a daily email digest of only the leads that fit your ICP.

Getting started

  1. Click Remix
  2. Save your OPENAI_API_KEY as an environment variable .
  3. Customize PROMPT.txt
  4. Get the HTTP endpoint from main.ts
  5. Point your webhook to this val's HTTP endpoint
  6. Add email recipients to the RECIPIENTS array in digest.ts
  7. That's it! You'll now receive a daily email digest of only your most qualified leads:

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 returns a consistent schema:

  • name - Human or company name (best available identification)
  • idealCustomer - "yes", "no", or "insufficient_data"
  • reasoning - 2-4 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)

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

Supported sources

Any webhook that sends JSON can be a source. Just POST to the endpoint with ?source=your-source-name:

  • RB2B: ?source=rb2b
  • Tally forms: ?source=tally
  • Zapier: ?source=zapier
  • Custom: ?source=anything

The AI researches and qualifies whatever you send.

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.