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

valdottown

Enrich-New-User

Get enriched new user data notifications
Public
Like
1
Enrich-New-User
Home
Code
8
.claude
1
.vscode
old-versions
3
.cursorrules
README-SETUP.md
deno.json
enriched-main.tsx
H
main.tsx
Branches
1
Pull requests
Remixes
1
History
Environment variables
2
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
/
/
x
/
valdottown
/
Enrich-New-User
/
branch
/
main
/
version
/
39
/
code
/
old-versions
/
clay-webhook-setup.md
/
old-versions
/
clay-webhook-setup.md
Code
/
/
x
/
valdottown
/
Enrich-New-User
/
branch
/
main
/
version
/
39
/
code
/
old-versions
/
clay-webhook-setup.md
/
old-versions
/
clay-webhook-setup.md
Search
7/10/2025
Viewing readonly version of main branch: v39
View latest version
clay-webhook-setup.md

Clay Webhook Setup for Store & Update Flow

Overview

This implementation sends an initial Discord notification immediately, then updates it with enriched data when Clay completes processing.

Flow

  1. User signs up β†’ Clerk webhook triggers
  2. Val sends basic info to Discord immediately (with "enriching..." message)
  3. Val sends data to Clay for enrichment
  4. Clay processes enrichment (takes 10-60 seconds)
  5. Clay calls back to your Val with enriched data
  6. Val sends a follow-up Discord message with full enrichment

Clay Configuration

1. Create HTTP API Webhook Column (Inbound)

  • Add "HTTP API" as first column
  • Set as webhook receiver
  • Copy the generated webhook URL
  • This receives data from your Val

2. Add Input Fields

Map these fields from the webhook data:

  • email
  • profile_image_url
  • signup_timestamp
  • callback_url (important!)

3. Add Enrichment Columns

  • Find Person from Email: Maps email β†’ person data
  • Enrich Company: Uses company from person data
  • Any other enrichments you want

4. Create HTTP API Callback (Outbound)

Add "HTTP API" column at the end:

  • Method: POST
  • URL: Use the {{callback_url}} field
  • Headers:
    { "Content-Type": "application/json", "Authorization": "Bearer YOUR_SECRET_KEY" }
  • Body: Map all enriched fields:
    { "email": "{{email}}", "full_name": "{{person_full_name}}", "company": "{{company_name}}", "title": "{{person_title}}", "linkedin": "{{person_linkedin_url}}", "location": "{{person_location}}", "industry": "{{company_industry}}", "company_size": "{{company_size}}", "company_website": "{{company_website}}" }

5. Set Trigger

  • Configure the table to run automatically when new rows are added
  • Or set it to run when webhook is received

Val.town Setup

Environment Variables

Add these to your Val:

  • CLAY_WEBHOOK_URL: The inbound webhook URL from Clay
  • CLAY_WEBHOOK_SECRET: A secret key for authenticating Clay callbacks
  • VAL_TOWN_URL: Your Val's base URL (e.g., https://yourval.val.run)
  • DISCORD_WEBHOOK: Your Discord webhook URL
  • CLERK_SECRET_KEY: Your Clerk authentication secret

Endpoints

Your Val now has two endpoints:

  1. /newUserWelcomeEmail - Receives Clerk webhooks
  2. /clayCallback - Receives Clay enrichment callbacks

Testing

  1. Trigger a test signup or manually call the Clerk webhook
  2. Check Discord for initial message with "Enriching data with Clay..."
  3. Wait 10-60 seconds for Clay to process
  4. Check Discord for second message with enriched data

Notes

  • Discord Limitation: Discord webhooks can't edit messages, so we send a second message
  • Storage: Current implementation uses in-memory storage (resets on Val restart)
  • Cleanup: Old pending enrichments are automatically cleaned up after 1 hour
  • Fallback: If Clay fails or is not configured, users still get the basic notification

Optional Enhancements

  1. Use Val.town Blob Storage: Store pending enrichments persistently
  2. Discord Bot: Use a bot token instead of webhook to edit messages
  3. Retry Logic: Re-send to Clay if enrichment fails
  4. Batching: Collect multiple signups and enrich in batches
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.