• 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
6
PROMPT.txt
README.md
agent.ts
dashboard.tsx
db.ts
H
main.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 main branch: v117
View latest version
README.md

Leads

AI-powered lead qualifying from any data source.

image.png

How it works

  • The HTTP endpoint at main.ts ingests all inbound POST request data and passes it to the OpenAI agent in agent.ts.
  • The agent uses the lead data from your POST request and its web search tool to determine if the lead is a match for the criteria in PROMPT.txt.
  • By default, the AI returns:
    { "name": "(normalized name)", "match": "(true or false)", "reasoning": "(explanation)" }
  • Every lead is added to the leads SQLite table with the columns:
    • id — auto-incremented, starts at 1
    • timestamp — Unix timestamp
    • input_data — JSON of your POST body
    • output_data — JSON of AI response
  • The main.ts dashboard shows a history of all lead assessments, successful matches first. Clicking any lead shows the full inbound and output data from the assessment.

Getting started

  1. Click Remix
  2. Save your OPENAI_API_KEY as an environment variable
  3. Customize PROMPT.txt (Don't remove any fields from the structured response)
  4. Get the val's HTTP endpoint from main.ts:
  5. Start forwarding leads to this webhook from any source as a POST request.
  6. That's it! You now have a growing leads SQLite table with one column for your original input_data and a second column for the AI evaluator's output_data. You also have a dashboard of this data hosted at the main.ts val endpoint.

Options

  • You can add any number of fields to the AI's output instructions in PROMPT.txt and they'll be added to output_data. You can use this to expand the AI's assessment, enrich your leads, or even just normalize lead data coming from different sources.
  • You can also add query parameters when you POST to the val endpoint. (ex: your-val-endpoint.val.run?source=signup-page). The parameters will be bundled in the _query object of input_data. This can be useful for tracking where a lead was forwarded from.
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.