Time-saving Automation: This tutorial shows you how to build a system that
can process hundreds of leads automatically, saving 5+ hours of manual
research per week while ensuring you focus on the right opportunities.
The Challenge: From Manual Research to Automated Intelligence
Every day, new users sign up for Linkup. When they do, we capture two crucial pieces of information:- Their company name
- Their email address
The Solution: An Automated Enrichment Pipeline to Qualify Leads
By the end of this tutorial, you’ll have a working system that:- Finds Official Websites: Cross-references company names with email domains
- Analyzes Company Websites: Determines how well each company fits your ideal customer profile
- Prioritizes Leads: Assigns a score from 1-5 so your team knows who to contact first
- Attio CRM data pull: to generate the input .json file with org names and company domains.
- Linkup API: to search the web and enrich the leads.
The Complete Process: Visual Overview
Here’s how the data transforms throughout this process:Project Setup: Getting Started
Let’s start with our project structure and requirements:1
Create Your Environment
First, let’s set up our environment and install the required packages:
2
Set Up Your API Keys
Create a
.env
file in your project directory with your API keys:Get your API key
Create a Linkup account for free to get your API key.
Never put your API KEYS directly in your code. Always include them in a
.env
file.3
Add your input file
Our starting point is a JSON file containing user signup information:
- Organizations
- Email address (or rather: the domains of the email addresses)
As you can see, data quality might not be optimal:
- Some users provide personal email addresses
- Others do not put the name of their company
The Enrichment Pipeline: Step-by-Step Implementation
Before we share the whole script (see the end of the tutorial), let’s break down our enrichment pipeline into steps:1
Finding Official Websites
Our first challenge is to reliably find the official website for each company. We’ll use Linkup’s API with a carefully crafted prompt:
Understanding key parameters:
- depth: “standard”: For website finding, “standard” depth provides a good balance between speed and accuracy
- outputType: “sourcedAnswer”: Returns a natural language answer with just the URL
- includeImages: “false”: We don’t need images, which speeds up the response
Prompt Design Strategy
Prompt Design Strategy
Notice how the prompt includes specific instructions:
- Only return results with 90% confidence
- Ignore generic company names
- Skip generic email domains
- Focus on professional email domains These constraints help ensure we get high-quality, reliable results.
2
Analyzing Company Fit
Once we have the website, we need to determine how well each company fits our ideal customer profile. For this, we’re using a second prompt to Linkup that gives the domain URL as input and asks for an ICP score as output.The output will be an ICP (Ideal Customer Profile) score ranging from 1-5:
We use ‘deep’ depth for ICP analysis because:
- It provides more thorough analysis of the company website
- It considers more pages and context when making its assessment
- The accuracy of ICP scoring is worth the slightly longer processing time
- 1 - Perfect match - AI companies, Tech Companies with clear API needs
- 2 - Strong potential - Corporates, Financial Firms, Consulting companies
- 3 - Moderate fit - Universities, Educational Institutions, Research Organizations
- 4 - Might need education - Companies with potential but unclear use cases
- 5 - Probably not a good fit - Consumer businesses, local services, etc.
3
Checking the results
After we run the script with these two API calls, a new file will be created with two new fields for each company:Great! As you can see, combining company name and email domain allows us to identify ICPs we would have missed if we had only considered one of the two factors.
- Website domain
- ICP Analysis
The complete script below includes additional functionality beyond the two
Linkup API calls shown above. For example:
- We implement logic to skip the ICP analysis call when no website is found, automatically assigning a rating of “1” (as seen in the second example output)
- We include an incremental processing system that only analyzes companies without existing ratings, preventing redundant API calls and allowing you to resume processing after interruptions
- The code handles file operations safely, maintains a processing counter, and includes appropriate rate limiting between API calls
Next Steps and Customization Opportunities
This script is just the beginning! Here are ways you can extend it:- Additional Enrichment: Add other API calls to find additional information (company industry, value chain positioning, pricing strategy…)
- CRM Integration: Add code to push results back to your CRM automatically (what we’re doing at Linkup)
- Multi-threaded Processing: Speed up processing by handling multiple companies simultaneously
The Complete Code
Below is the complete Python script that implements our lead qualification system. The file is more complex than the two functions to allow for observability, troubleshooting, batch processing, etc. Do not hesitate to reach out if you have any questions.Try It Yourself
Customize Your ICP Definition
Customize Your ICP Definition
Try modifying the ICP analysis prompt to match your specific business needs:
- Update the description of your company
- List your target industries
- Define what makes an ideal customer for you
- Run the script and see how the results change
Add Company Size Estimation
Add Company Size Estimation
Extend the script to also estimate company size:
- Create a new function similar to
analyze_icp_fit
- Craft a prompt asking Linkup to estimate employee count
- Add this data to your results structure
- Use it as an additional factor in prioritization
Conclusion
You’ve now built an automated system that transforms basic CRM information into actionable intelligence. By leveraging the Linkup API, you can:- Save Time: Eliminate manual research
- Improve Targeting: Focus on the most promising leads
- Scale Your Process: Handle hundreds of leads with ease
Facing issues? Reach out to our engineering team at support@linkup.so or via our Discord or book a 15 minutes call with a member of our technical team.