Public
Like
github-leads-multi-company
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.
Monitor GitHub activity across multiple organizations and use AI to qualify leads. Each company gets its own custom prompt, dashboard, and email digest.
- Monitor GitHub events for multiple organizations from one val
- AI qualifies each lead using a custom prompt per company
- Each company has its own dashboard and email digest
- Export any company's data for migration to a standalone val
- Add
OPENAI_API_KEYandGITHUB_TOKENto Environment Variables - Visit the dashboard at the val's HTTP endpoint
- Click Admin → Add Company
- Configure:
- Display Name: Human-readable name (e.g., "Acme Corp")
- Slug: URL-safe identifier (e.g., "acme-corp")
- GitHub Org: The GitHub org to monitor
- Recipients: Comma-separated emails for daily digest
- Prompt: Customize the AI qualification criteria
| Path | Description |
|---|---|
/ | Home - lists all companies |
/c/{slug} | Company dashboard |
/c/{slug}/lead/{id} | Lead detail page |
/c/{slug}/export | Export company data as JSON |
/admin | Manage companies |
/admin/new | Add a company |
/admin/{id} | Edit a company |
/webhook/{slug} | POST endpoint for external lead sources |
Cron Job (github.cron.ts)
- Runs on schedule and processes all active companies
- Fetches recent GitHub events for each org
- Groups events by actor and sends to AI
AI Agent (agent.ts)
- Uses each company's custom prompt
- Web searches to research the lead
- Returns
{name, match, score, leadTypes, reasoning}
Storage (db.ts)
github_leads_companies_v1- company configurationsgithub_leads_v4- leads withcompany_idforeign key
Dashboard (dashboard.tsx)
- Home page lists all companies with stats
- Per-company views show qualified vs non-matched leads
Digest (digest.ts)
- Runs daily and sends separate emails per company
- Only sends to companies with configured recipients
When you want to give a company their own standalone val:
- Go to
/c/{slug}/exportto download the JSON - Create a new val from the single-company template
- Import the JSON into their SQLite table
- Delete from this multi-company val via Admin
| Variable | Description |
|---|---|
OPENAI_API_KEY | Required for AI lead qualification |
GITHUB_TOKEN | Required for GitHub API access |
| File | Description |
|---|---|
main.ts | HTTP entry point, routes |
db.ts | Companies + leads SQLite operations |
agent.ts | AI lead qualification |
github.cron.ts | Scheduled GitHub monitoring |
digest.ts | Daily email digest per company |
dashboard.tsx | Multi-company dashboard UI |
admin.tsx | Company management UI |