8 min read

[B2B Sales Automation] How to Use Dify × Bright Data SERP API to Fully Automate High-Accuracy Lead Lists and Personalized Outreach for More Deals

By integrating the LLM app development platform Dify with Bright Data's SERP API, this workflow automatically extracts the companies you should approach right now from target keywords and generates sales emails automatically.

This article was automatically translated from the original Japanese version and may contain mistranslations. Please refer to the Japanese original for the most accurate wording.
[B2B Sales Automation] How to Use Dify × Bright Data SERP API to Fully Automate High-Accuracy Lead Lists and Personalized Outreach for More Deals

Note

This article was written in partnership with Bright Data. The links in this article include affiliate links.

“I spent 3 hours a day building lists, only to get a reply rate of under 1%” — if you work in B2B new business sales, you’ve probably felt that sense of futility at least once.

The real problem is not effort, but the quality of the approach. Sending generic emails without deeply understanding the target company creates a bad impression of your brand and leads to missed opportunities.

This time, I built a workflow that connects the LLM app development platform Dify with the SERP API from Bright Data, one of the world’s largest data collection infrastructures, to create a workflow that automatically extracts “companies you should approach now” from target keywords and instantly generates sales emails that dig into each company’s specific challenges.

The template I created is available on Dify Marketplace.
The link is listed near the end of the article.

1. The Challenge of “Target Extraction” in Companies and the Benefits of Introducing This Tool

According to a HubSpot study, sales reps spend only 34% of their total work time on actual “deals and proposals.” The remaining 66% is consumed by “prep work” such as list building, research, and email writing.

In corporate inside sales teams, the following challenges are becoming more apparent:

  1. Aging lists and clashes with competitors: Lists bought from vendors are often stale, and because everyone sends similar template emails to the same companies, reply rates drop sharply. Industry-average cold email reply rates are said to be 1% to 5%, and the limits of generic outreach are obvious.
  2. Growing research workload: Looking up each target company’s business one by one and figuring out “why they need your product” takes 15 to 30 minutes per company per rep. Just building a list of 10 companies can easily burn half a day.
  3. Brand damage: Mass emails that miss the mark because they don’t understand the other company’s business model directly lead to a negative impression of your brand. Once you’re seen as a “spam company,” future outreach becomes effectively useless.

This workflow solves these three problems by combining “SERP (search engine results page) data” and “LLM.”

Companies that appear near the top of Google search results are the ones that are currently active and influential in that area. By using Bright Data’s API to fetch these latest search results as structured data, and having the LLM compare “your product’s strengths” with “the target company’s business,” you can scale high-quality personalized proposals with a clear “Why You” at zero manual effort.

Traditional methodThis workflow
List building: 15–30 minutes per companyAfter entering a keyword, automatically extract the top 10 companies in seconds
Uniform template emailsAutomatically generate personalized emails based on the company’s business
Reuse old purchased listsFetch the latest Google search results every time it runs

2. The Overall Workflow Design and How the Automation Works

The workflow built in Dify this time is designed so that data flows seamlessly from input to output.

  1. User input: Enter the “search keyword” for the companies you want to find, plus your own “product name and sales pitch.”
  2. Code execution: Use Python to URL-encode the input values and generate parameters for Bright Data.
  3. HTTP request: Call the Bright Data SERP API and retrieve Google search results (title, snippet, URL, etc.) as JSON.
  4. Template: Combine the search results with your product information to dynamically generate context for the LLM.
  5. LLM: Analyze the data and create a list of top prospects plus personalized outreach emails.

The first step, parameter generation in Python, looks like this:

import urllib.parse

def main(keyword: str, language: str) -> dict:
    encoded = urllib.parse.quote_plus(keyword)
    lang = language.strip().lower() if language.strip() else "en"
    
    # Simple regional parameter (gl) mapping
    gl_map = {"ja": "jp", "en": "us", "fr": "fr", "de": "de", "ko": "kr"}
    
    return {
        "encoded_keyword": encoded,
        "hl": lang,
        "gl": gl_map.get(lang, "us")
    }

About the number of search results fetched

Due to changes in Google’s specifications, bulk-fetch parameters such as num=100 (fetch 100 results) no longer work properly through APIs. This workflow is designed to fetch the most valuable and reliable 10 results at the top.

3. Why Bright Data SERP API Instead of Building Your Own Scraper

If you try to scrape search results with an in-house build, you’ll inevitably run into the walls of “CAPTCHA” and “IP blocks.” If you’re automating part of a company’s business process, getting stopped here is fatal.

Bright Data is an enterprise-grade data collection platform with more than 72 million IP nodes across 150+ countries and regions, and it’s used by over 20,000 companies worldwide, including Fortune 500 companies. By routing through that proxy network, you can completely avoid blocks and build a stable, business-grade data pipeline.

How to sign up for Bright Data’s free trial and apply the promo code

If you create an account from the dedicated link below, you’ll receive $20 in free credits that can be used to test the API.

👉 Sign up for Bright Data ($20 credit included)

How to apply the promo code from the dashboard after signing up

  1. Go to Bright Data, register an account, and log in
  2. Open “Billing & Payments” from the left navigation bar
  3. In the first “Overview” tab, you’ll see a field labeled “Apply promo code”; click there
  4. Enter the promo code harupython in the input field and click “Apply
  5. Confirm that the credit has been reflected on the same Overview page

Once the code has been applied, all you need to do is create a SERP API Zone and get an API key, and you can start running the workflow right away.

The clean data you retrieve is combined with your own company information in Dify’s template node.

# User Intent & Context
Search Keyword: {{ keyword }}
Language: {{ hl }}

# Sender Information (Optional)
Company Name: {{ company_name }}
Product/Service Name: {{ product_name }}
Value Proposition & Selling Points: {{ selling_points }}

# Search Results Data
{{ output }}

Then, the following system prompt makes the LLM function like an “excellent inside sales rep.”

You are an expert B2B Sales Intelligence and Outreach AI.
Always respond entirely in the language specified by the user.

You will receive Google search results data based on the user's target keyword, along with the user's company and product information (if provided).

Your task is to analyze the search results, identify the best potential B2B leads, and write highly personalized cold outreach emails pitching the user's product.

This produces not just a summary of the information, but a proposal-style email based on a hypothesis about the other company’s challenges.

4. Example Output and B2B Use Cases

As a real example, I ran it assuming I was pitching my ultra-lightweight database, NanaSQLite, using the keyword サポーターズ (assuming an engineer recruiting / event support company).

Execution result of Dify workflow 1 Execution result of Dify workflow 2

The LLM analyzed the information on the top-ranked company websites and generated proposal copy that went deep into the actual business details of the companies, such as “speeding up search for a platform handling large volumes of student data” and “introducing a lightweight DB as infrastructure for hackathons.” It’s a far cry from a template email, and clearly communicates “why this company was contacted.”

This automation workflow is especially powerful in scenarios like these:

  • SaaS vendor sales strategy: Search with specific industry keywords and mass-produce high-quality outreach lists tied to the benefits of your own service.
  • IT consulting / custom development: Offer pinpoint technical proposals to companies that rank highly for queries like “XX industry DX” but appear to be struggling with technical bottlenecks.
  • Marketing agencies: Extract companies that are actively spending on ads and present your own operational know-how together with concrete improvement hypotheses.

By handing the task of list building over to APIs and AI, sales reps can focus on the truly important work: “strategy planning” and “talking with customers.” First, try using the free credits to see how personalized a proposal your own product can generate.

👉 Sign up for Bright Data ($20 credit included)
👉 View the template on Dify Marketplace

Related Articles