Building an Automated LinkedIn Lead Generation System with n8n and SalesQL: Custom Search Criteria Setup and CRM Integration

Break free from manual LinkedIn lead generation! With the powerful combination of n8n and SalesQL, you can set custom search criteria and seamlessly integrate with your CRM system to automate your lead generation process and maximize efficiency. Stop wasting time. It's time to focus on growth.

1. The Challenge / Context

LinkedIn is a crucial lead generation channel in B2B business, but manually searching profiles and extracting information takes a lot of time and effort. It's especially difficult to find precise target customers based on specific industries, job titles, or tech stacks. This inefficiency hinders the productivity of sales and marketing teams and ultimately negatively impacts business growth. Therefore, it's essential to automate the lead generation process and integrate it with CRM systems to increase efficiency.

2. Deep Dive: n8n and SalesQL

n8n is a low-code workflow automation platform. It allows you to automate complex tasks by connecting various services and APIs, and its intuitive interface makes it easy to build and manage workflows. SalesQL is a service that extracts profile information from LinkedIn and finds email addresses. It can be integrated with LinkedIn Sales Navigator to set more precise search criteria, and extracted data can be exported in various formats such as CSV and Excel.

The core of n8n is node-based workflow building. Each node performs a specific task, and connections between nodes define the data flow. For example, a SalesQL node can extract profile information from LinkedIn, and an HTTP Request node can send data to a CRM system. n8n supports various triggers (e.g., schedules, webhooks) to help build automated workflows.

3. Step-by-Step Guide / Implementation

Now, let's explore in detail how to build an automated LinkedIn lead generation system using n8n and SalesQL, step by step.

Step 1: Obtain SalesQL API Key

To use the SalesQL API, you need an API key. Log in to your SalesQL account to obtain an API key. The API key will be used to authenticate the SalesQL node in your workflow.

Step 2: Create an n8n Workflow

Create a new workflow in the n8n editor. Set the workflow's start to a Cron trigger so that it runs periodically.

{
  "nodes": [
    {
      "parameters": {
        "cronExpression": "0 8 * * *"
      },
      "name": "Cron",
      "type": "n8n-nodes-base.cron",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    }
  ],
  "connections": []
}

The code above is an example of setting a Cron trigger to run the workflow every day at 8 AM.

Step 3: Add and Configure SalesQL Node

Add a SalesQL node to your n8n workflow. The SalesQL node can be used by installing the `n8n-nodes-salesql` package. In the node's settings, enter your API key and configure the search criteria. For example, you can search for a specific job title ("Software Engineer"), industry ("Technology"), and location ("Seoul").

{
  "nodes": [
    {
      "parameters": {
        "operation": "search",
        "companyName": "",
        "email": "",
        "firstName": "",
        "lastName": "",
        "linkedinURL": "",
        "location": "Seoul",
        "phoneNumber": "",
        "profileURL": "",
        "school": "",
        "searchText": "Software Engineer",
        "title": "Software Engineer",
        "industry": "Information Technology and Services",
        "numberOfPages": 1
      },
      "name": "SalesQL",
      "type": "n8n-nodes-salesql.salesql",
      "typeVersion": 1,
      "position": [
        480,
        300
      ],
      "credentials": {
        "salesqlApi": "YOUR_SALESQL_API_KEY"
      }
    }
  ],
  "connections": {
    "Cron": {
      "main": [
        [
          {
            "node": "SalesQL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Note: You must replace YOUR_SALESQL_API_KEY with your actual SalesQL API key.

Step 4: Data Transformation (Optional)

If the data format returned by SalesQL does not match your CRM system, you can use a Function node to transform the data. For example, you can combine first and last names or delete specific fields.

const items = $input.all();
let newItems = [];

for (let item of items) {
  let newItem = {
    json: {
      fullName: item.json.firstName + " " + item.json.lastName,
      email: item.json.email,
      linkedinURL: item.json.profileURL
    }
  };
  newItems.push(newItem);
}

return newItems;

The code above is an example of combining firstName and lastName extracted from SalesQL to create a fullName field, and extracting only the necessary information to create a new data structure.

Step 5: CRM System Integration

Use n8n's HTTP Request node or a dedicated CRM system node to send data to your CRM system. If using the HTTP Request node, you need to configure the CRM system's API endpoint and authentication method.

{
  "nodes": [
    {
      "parameters": {
        "requestMethod": "POST",
        "url": "YOUR_CRM_API_ENDPOINT",
        "options": {},
        "bodyContentType": "json",
        "bodyParametersJson": "={\n  \"fullName\": \"{{ $json.fullName }}\",\n  \"email\": \"{{ $json.email }}\",\n  \"linkedinURL\": \"{{ $json.linkedinURL }}\"\n}",
        "headerParametersUi": {
          "parameter": [
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Authorization",
              "value": "Bearer YOUR_CRM_API_TOKEN"
            }
          ]
        }
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        720,
        300
      ]
    }
  ],
  "connections": {
    "Function": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Note: You must replace YOUR_CRM_API_ENDPOINT and YOUR_CRM_API_TOKEN with your actual CRM system's API endpoint and authentication token.

Step 6: Error Handling and Logging

It is crucial to handle errors that may occur during workflow execution and to log the execution results. You can use an IF node to detect errors and a Logger node to record logs.

4. Real-world Use Case / Example

As a marketing automation consultant, I utilized this system to automate the LinkedIn lead generation process for my clients. Previously, the sales team spent a significant amount of time manually searching for leads and collecting information from LinkedIn Sales Navigator. By integrating n8n and SalesQL to build an automated workflow, we reduced the time spent on lead generation by over 80%, allowing the sales team to focus on more valuable activities. It was particularly effective for targeting developers using specific tech stacks.

5. Pros & Cons / Critical Analysis

  • Pros:
    • Time saving and efficiency improvement
    • Accurate target customer discovery
    • Seamless integration with CRM systems
    • Easy workflow building with low-code
  • Cons:
    • Cost incurred based on SalesQL API usage
    • Potential need for workflow modification due to LinkedIn policy changes
    • Understanding of CRM system API required

6. FAQ

  • Q: How do I manage SalesQL API usage?
    A: You can check your API usage in your SalesQL account and purchase more API credits if needed.
  • Q: How do I install n8n?
    A: Refer to the official n8n documentation (https://docs.n8n.io/) to install it using various methods such as Docker, npm, etc.
  • Q: How should I respond to LinkedIn policy changes?
    A: If LinkedIn policies change, the behavior of the SalesQL API may also change. You should monitor SalesQL updates and modify your workflow if necessary.

7. Conclusion

The automated LinkedIn lead generation system using n8n and SalesQL can be a powerful tool to maximize the productivity of sales and marketing teams and accelerate business growth. Install n8n now, obtain your SalesQL API key, and start building automated workflows. It will help you save time, acquire more leads, and grow your business. You can find more information by referring to the official n8n documentation (https://docs.n8n.io/) and SalesQL API documentation.