• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
project logo

templates

rb2b

Find ICP customers who visit our website
Public
Like
rb2b
Home
Code
8
PROMPT.txt
README.md
agent.ts
dashboard.tsx
db.ts
C
digest.ts
H
main.ts
testing.ts
Branches
1
Pull requests
Remixes
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
/
Code
/
Search
main.ts
https://templates--019aef13047573bdb8a8440fc33c9390.web.val.run
README.md

RB2B Lead Filter

Connect this val to RB2B for an AI-powered digest of your most qualified leads.

Getting started

  1. Remix this val
  2. Set OPENAI_API_KEY in this val's environment variables
  3. Copy the HTTP endpoint for main.ts into rb2b's webhook integration
  4. Customize PROMPT.txt with instructions for how to properly research if a lead represents an ideal customer, and anything you want the agent to include in its reasoning. (Don't change how it structures its final response).
  5. Specify which email(s) to send the daily digest in RECIPIENTS in digest.ts

You will now receive a daily email of only your most qualified RB2B leads at 8am PST.

How it works

  • Once you've added your val's HTTP endpoint rb2b's webhook integration, rb2b will begin forwarding every new lead to this val.
  • When a new lead comes in from RB2B, it is forwarded along with the instructions in PROMPT.txt to an OpenAI agent. The agent uses its reasoning and web search tool to determine if the lead represents an idealCustomer and explains its reasoning.
  • The RB2B data and agent results are saved in the rb2b_leads_v2 sqlite table, and the agent's entire run history is saved in blob storage.
  • The main.ts dashboard shows a history of all runs, ideal customers first. Clicking any lead will take you to its runId page, where you can view the agent's reasoning as well as all sqlite and blob data from the entire process (this is what is included when an idealCustomer is added to the email digest):

  • digest.ts runs every day at 8am PST by default.
  • Feel free to change the timing and frequency of the digest.ts cron. It always checks when it was last run and sends every new idealCustomer to the owner of this val (and any additional email addresses included in the recipients array).
HTTP
  • main.ts
    templates--01…90.web.val.run
Cron
  • digest.ts
Code
PROMPT.txtREADME.mdagent.tsdashboard.tsxdb.ts
C
digest.ts
H
main.ts
testing.ts
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.