Clay doesn't offer an API, but you can simulate an API via Val Town by listening to webhooks, enriching data in Clay, and having Clay send an HTTP request back when enrichment is complete.
This demo uses Clay like an API to automatically enrich new user signups and send notifications to Discord.
Here's an example:
Here's the underlying Clay Table (feel free to zoom in to see the exact setup
for debugging):
This project uses the Hono framework with a clean, flat architecture:
├── enrichedUserWebhook.ts # Receives enriched data from Clay
├── newUserWebhook.ts # Receives new signups from Clerk/Stripe
├── discordNotifications.ts # Discord message formatting and buttons
├── types.ts # TypeScript interfaces
├── test-signup.ts # Test utility
├── main.tsx # Hono app entry point with routing
├── deno.json # Deno configuration
└── README.md # This file
Create a new Clay workbook called "New User Enrichment"
Click Add → Pull in data from source at the bottom
Select Pull in data from a Webhook Table
Click Edit source on the Webhook column to copy the webhook URL
Add the webhook URL to your environment variables:
CLAY_WEBHOOK_URLhttps://api.clay.com/v3/sources/webhook/pull-in-data-from-a-webhook-YOUR_IDNote: Setting up the webhook like this lets you transform / filter the data before sending it over to Clay. It also helps with error handling and give you logs in Val Town for observability. Otherwise, you could set up the webhook directly from the source ie. Clerk, Stripe etc.
Add whichever enrichment columns you want. This example uses:
https://your-val-url.com/enrichedUserWebhook
(Note: you need the /enrichedUserWebhook!){ "email": "{{email}}", "profile_image_url": "{{profile_image_url}}", "Name": "{{name}}", "Title": "{{title}}", "Org": "{{org}}", "LinkedIn": "{{LinkedIn Profile}}" }
Required:
CLAY_WEBHOOK_URL - Your Clay webhook URL from step 1DISCORD_WEBHOOK - Your Discord webhook URL for notificationsThis is what triggers a new row in the Clay table, hook up your source system
(Clerk, Stripe, etc.) to send webhooks to your val's HTTP URL:
https://your-val-url.com/newUserSignup (Note: you need the
/newUserSignup!)
For Clerk, you can find it here:
This project integrates with this val for sending personalized outreach emails to new users.
When Clay enriches a user and sends the data back to Val Town, the Discord notification includes two interactive buttons:
The "Preview & Send Email" button links to:
https://send-lead-gen-email.val.run
This external service receives the enriched user data via URL parameters:
name - The user's full name (if available)email - The user's email addresstitle - The user's job title (if available)org - The user's organization (if available)New user John Doe (CEO at TechCorp) signs up
Clay enriches the data with name, title, and company
Discord notification appears with enriched info
Clicking "Preview & Send Email" opens:
https://send-lead-gen-email.val.run?name=John%20Doe&email=john@techcorp.com&title=CEO&org=TechCorp
The external service handles email preview, customization, and sending
Enriched profiles (with ⭐):
⭐ New user! John Doe • Software Engineer @ Tech Corp • john@example.com • https://linkedin.com/in/johndoe
Basic signups:
New user! user@example.org