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: v64View latest version
AI-powered lead filtering from any data source. Includes a dashboard and a daily
email digest of only the leads that fit your ICP.
- 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
- Add email recipients to the
RECIPIENTSarray indigest.ts - That's it! You'll now receive a daily email digest of only your most
qualified leads:
- 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 research the person and determine if they represent anidealCustomer, then explains itsreasoning. - The input data and agent results are saved in the
leadssqlite table. - The
main.tsdashboard 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.tsruns every day by default.- Feel free to change the timing and frequency of the
digest.tscron. It always checks when it was last run and sends every newidealCustomerto the recipients in the array.
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.