Skip to main content
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
When we had a few signups every day, our team could spend time researching each company manually and identify the most important ones. But as we grow and the number of daily signups becomes too high to handle manually, we face a challenge: How do we know which leads to focus on first? Before automation: Our sales team spent hours manually researching each company, often missing high-value opportunities because of the volume. After automation: We instantly identify and prioritize the most promising leads based on AI-powered analysis of their company profile and website.

The solution: an automated enrichment pipeline to qualify leads

By the end of this tutorial, you’ll have a working system that:
  1. Finds official websites: cross-references company names with email domains
  2. Analyzes company websites: determines how well each company fits your ideal customer profile
  3. Prioritizes leads: assigns a score from 1-5 so your team knows who to contact first
For this tutorial, we are going to use:
  • 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)
In our case, we extracted this file from our CRM (Attio) since this is where we send signup data (and want to send the enriched data back after the process). This file could be the output of a signup form or any lead generation document you’re using.Let’s look at the structure:
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
This is why we’re combining both information to try and get better results.We could add a Linkup search for LinkedIn profiles associated with the first part of the emails.

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, the agent breaks down your prompt into as many calls to our index as needed (both search and scrape) in a single pass. Use "fast" for a single, direct call to our index, ideal for simple lookups at the lowest latency.
  • outputType: "sourcedAnswer": returns a natural-language answer with just the URL.
  • includeImages: false: we don’t need images, which speeds up the response.
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.
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
The output will be an ICP (Ideal Customer Profile) score ranging from 1-5:
  • 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.
Notice how we don’t have to explicitly explain our rating system - AIs understand it intuitively.
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:
  • Website domain
  • ICP Analysis
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.
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:
  1. Additional enrichment: add other API calls to find additional information (company industry, value chain positioning, pricing strategy…)
  2. CRM integration: add code to push results back to your CRM automatically (what we’re doing at Linkup)
  3. Multi-threaded processing: speed up processing by handling multiple companies simultaneously
In our case, we’re actually sending the data back to our CRM so that new signups get automatically rated. We then have live alerts that tell us when important customers sign up to our products.

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

Try modifying the ICP analysis prompt to match your specific business needs:
  1. Update the description of your company
  2. List your target industries
  3. Define what makes an ideal customer for you
  4. Run the script and see how the results change
Extend the script to also estimate company size:
  1. Create a new function similar to analyze_icp_fit
  2. Craft a prompt asking Linkup to estimate employee count
  3. Add this data to your results structure
  4. 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:
  1. Save time: eliminate manual research
  2. Improve targeting: focus on the most promising leads
  3. Scale your process: handle hundreds of leads with ease
This approach combines the best of both worlds: AI-powered analysis with your business expertise to define what makes an ideal customer. For more sophisticated implementations, check out our other tutorials or reach out to our support team!
Need help? Email support@linkup.so, ping us on Discord, or talk to us.