Unlisted
Like
leads
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.
Viewing readonly version of simplified branch: v82View latest version
AI-powered lead filtering from any data source.
- Click Remix
- Save your
OPENAI_API_KEYas an environment variable - Customize
PROMPT.txt - Copy the HTTP endpoint from
main.ts: - Point your webhook to this val's HTTP endpoint
- That's it! Every new lead that is passed to this val will be stored in an
SQLITE database where the
REASONINGcolumn explains why theMATCHcolumn istrueorfalse
- When a new lead comes in via POST, it is forwarded along with the instructions
in
PROMPT.txtto an OpenAI agent. The agent uses web search to determine ifmatchshould betrueorfalseand explains itsreasoning. - The input data and agent results are saved in the
leadssqlite table. - The
main.tsdashboard shows a history of all leads, successful matches first. Clicking any lead shows the agent's reasoning and all incoming and outgoing data from the process
The agent normalizes data from any source and returns a consistent schema:
name- Full name of the personcompany- 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
Each lead stores a raw_data JSON blob containing:
input- The original payload from the webhook sourceaiOutput- The agent's structured responserunData- Metadata about the run (timestamps, token usage, stop reason)
You can view this on the lead detail page by expanding the "Raw Data" section.
-
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.