Back to Blog

Building Intelligent Contact Profiling: When AI Meets Business Intelligence

How we built an AI-powered contact research system that automatically profiles prospects using LinkedIn, Twitter, GitHub, and news sources - all while maintaining privacy and security.

·5 min read·Chris Knuteson
aicloudflarebusiness-intelligenceprivacyautomation

We built an AI system that automatically researches anyone who contacts us. Here's why and how.

The Problem

Contact forms are broken. Someone fills out a form, you get an email with their name and message, and that's it. You're left googling them, checking LinkedIn, trying to piece together who they are and what they actually need.

For a consulting business, this is backwards. The more context you have upfront, the better you can help them. But manual research takes time, and you miss things.

The Solution: AI-Powered Contact Intelligence

When someone submits our contact form, our system automatically:

  • Researches their professional background on LinkedIn
  • Finds their company information and industry context
  • Discovers their social media presence (Twitter, GitHub)
  • Searches for recent news mentions or achievements
  • Compiles everything into a comprehensive profile
  • Sends us a rich email with all the intelligence

All of this happens in the background, usually completing within 5 minutes of form submission.

Why We Moved from Supabase

Our previous setup was Vercel + Supabase. It worked, but had limitations:

  • Database pausing: Supabase free tier would sleep, causing contact form failures
  • Cost scaling: Would get expensive as we added AI features
  • Complexity: Multiple platforms to manage and monitor
  • Performance: Database wake-up delays hurt user experience

Cloudflare Workers + D1 solved all of this for $5/month total.

The AI Research Pipeline

The system uses OpenAI's latest models with custom tools:

Company Intelligence

// Enhanced company lookup with industry mapping
const companyData = await lookupCompany(emailDomain);
// Returns: industry, description, size, confidence score

Social Profile Discovery

// Multi-platform social research
await Promise.all([
  searchLinkedIn({ name, company }),
  searchTwitter({ name, company }),
  searchGitHub({ name, email }),
  searchNews({ name, company }),
]);

Data Synthesis

The AI combines all sources into a structured profile with confidence scoring. Low-confidence data gets flagged for manual review.

Privacy by Design

We're careful about what we collect and how long we keep it:

  • Minimal data collection: Only public information that's already searchable
  • Confidence scoring: Uncertain data is clearly marked
  • Data retention: Profiles expire automatically
  • No tracking: We don't follow up or retarget based on research
  • Transparency: Clear about what we're doing and why

The goal is business context, not surveillance.

Security Architecture

Multiple layers protect against abuse:

CSRF Protection

Origin and referer validation prevents cross-site request forgery:

const allowedOrigins = [
  "https://ctkadvisors.net",
  "https://www.ctkadvisors.net",
];

const isValidOrigin = origin && allowedOrigins.includes(origin);
if (!isValidOrigin && !isValidReferer) {
  return { success: false, error: "Invalid request origin" };
}

Turnstile Protection

Every form submission requires Cloudflare Turnstile verification:

const turnstileResult = await verifyTurnstileToken(
  data.turnstileToken,
  clientIP,
  secretKey
);

Multi-Layer Rate Limiting

  • Email-based: Prevents duplicate submissions (1 hour window)
  • IP-based: Max 5 submissions per hour per IP address
  • Turnstile: Bot protection and human verification

Input Validation

  • Server-side validation on all inputs
  • SQL injection protection via prepared statements
  • XSS prevention through proper escaping

Real-World Results

The system has transformed our contact process:

Before:

  • Manual research taking 10-15 minutes per contact
  • Missing context leading to generic responses
  • Delayed follow-ups while gathering information

After:

  • Automatic research completing in 5 minutes
  • Rich context enabling personalized responses
  • Immediate follow-up with relevant information

Example profile generated:

  • Contact: Jeff Bezos, jeff@amazon.com
  • Title: Non Executive Director at Amazon Web Services
  • Industry: E-commerce and Cloud Computing
  • Social: LinkedIn + Twitter profiles
  • Context: Recent news mentions and achievements
  • Confidence: 80% (high quality data)

Technical Architecture

Built entirely on Cloudflare's edge platform:

  • Workers: Serverless compute for form handling and AI processing
  • D1 Database: SQLite for contact storage and research results
  • Durable Objects: Queue management for background processing
  • KV Storage: Caching and fallback data
  • Scheduled Workers: Cron jobs for AI research pipeline

The entire system runs globally at the edge, with sub-100ms response times.

Cost Efficiency

Monthly costs breakdown:

  • Cloudflare Workers: $5/month (includes everything)
  • OpenAI API: ~$10/month for AI research
  • Serper API: ~$5/month for web search

Total: $20/month for unlimited contact intelligence.

Compare to hiring a VA for research: $15/hour × 10 minutes per contact = $2.50 per contact. We break even at 8 contacts per month.

What's Next

The system is working well, but we're adding:

  • Enhanced verification: Cross-reference multiple sources for accuracy
  • Industry-specific research: Tailored intelligence based on business sector
  • Integration workflows: Automatic CRM updates and follow-up sequences
  • Analytics dashboard: Track research quality and business impact

Lessons Learned

AI tools are powerful when you give them structure. The key was building specific tools for LinkedIn search, company lookup, and news research rather than asking the AI to "figure it out." It made up crap more often than not.. and getting the signature to force tool caling was a bit of a headache. In the end though, it works well.

Privacy matters more than features. We could collect much more data, but chose restraint. Business context, not personal surveillance.

Edge computing works for AI workloads. Running everything on Cloudflare's edge gives us global performance without the complexity of multi-region deployments.

Security is foundational. Turnstile, rate limiting, and input validation aren't afterthoughts - they're essential.

The result is a contact form that actually helps us help people better. Which is the whole point.


Interested in building something similar? The patterns here work for any business that needs better prospect intelligence. The key is starting simple and adding intelligence gradually. Use the form, contact us!

Share this post