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 main branch: v47View latest version
Lead qualifying from any data source.
- This val is a webhook
- You can POST arbitrary lead data to it from anywhere
- An AI agent sorts the good leads from the bad leads
- Leads are stored and arranged in a dashboard
- Click Remix
- Click here to save your
OPENAI_API_KEYas an environment variable - Customize
PROMPT.txt(Don't remove any fields from the structured response) - Get the val's HTTP endpoint from
main.ts: - Forward leads to this webhook as a POST request.
- That's it! Watch them drop into your dashboard at
main.ts
- The HTTP endpoint at
main.tsingests all inbound POST request data and passes it to the OpenAI agent inagent.ts.
- The agent uses the lead data from your POST request and its web search tool to
determine if the lead is a
matchfor the criteria inPROMPT.txt. - By default, the AI returns
{name, match, reasoning}. This is theoutput_data.
- Every lead is added to the
leadsSQLite table:id,timestamp,input_data,output_data. - The
main.tsdashboard shows a history of all lead assessments, successful matches first. Clicking any lead shows the full inbound and output data from the assessment.
- Add fields to the AI's output instructions in
PROMPT.txtto: - enhance AI's assessment
- enrich your leads
- normalize lead data from different sources.
- add query parameters to your POST
- (ex: your-val-endpoint.val.run?source=signup-page`)
- The parameters will be bundled in the
_queryobject ofinput_data.