Automate Lead Qualification with Gmail, OpenAI & Pipedrive

Struggling to manually qualify leads from cold email replies? This workflow automatically reads email replies, assesses lead interest using OpenAI, and creates deals in Pipedrive, saving hours of manual work.
gmailTrigger
pipedrive
openAi
+4
Workflow Identifier: 1026
NODES in Use: gmailTrigger, set, pipedrive, if, openAi, code, stickyNote

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

What This Workflow Does

This workflow checks new email replies in Gmail inboxes and sees if the sender wants a meeting or call.
It looks up the sender in Pipedrive CRM and sees if that person is active in a campaign.
Then it asks OpenAI’s GPT-4 to read and judge the reply for interest and reasons.
If the reply shows interest, it creates a new deal linked to that person in Pipedrive.
The workflow saves time by doing all steps automatically.


Who Should Use This Workflow

Sales teams that send many cold emails to CEOs or founders.
Anyone who wastes time reading replies to find real leads.
It suits users with Pipedrive CRM and Gmail accounts.
Users wanting to cut manual work and find real interested leads fast.


Tools and Services Used

  • Gmail: To watch for email replies.
  • OpenAI GPT-4: To read and judge interest in replies.
  • Pipedrive CRM: To find contacts and create deals.
  • n8n Automation: To connect all parts and run the workflow.
  • OPTIONAL: self-host n8n for data control.

Input, Processing, and Output

Inputs

  • New email reply from monitored Gmail inboxes.
  • Sender email address to find contact in CRM.
  • Email reply text for OpenAI evaluation.

Processing

  • Check Gmail inbox every minute for new replies.
  • Search contact in Pipedrive by sender email.
  • Verify contact is part of an active campaign using “in_campaign” field.
  • Send email reply text to OpenAI GPT-4 for interest and reason analysis.
  • Parse OpenAI response for “interested” yes/no and “reason”.
  • If interested is yes, create a new deal linked to the contact in Pipedrive.

Output

  • A new deal in Pipedrive CRM for contacts that reply showing interest.
  • Structured data about interest and reasons stored in the workflow.

Beginner Step-by-Step: How to Build This Workflow in n8n

Step 1: Import the Workflow File

  1. Download the workflow file from the Download button on this page.
  2. Open your n8n editor already logged in.
  3. Use the menu option Import from File and select the downloaded file.

Step 2: Configure Credentials and Settings

  1. Add your Gmail account API credentials in the Gmail Trigger nodes.
  2. Insert your OpenAI API key in the OpenAI GPT-4 node.
  3. Add your Pipedrive API key in all Pipedrive nodes.
  4. Check and update the in_campaign custom field ID if needed in the CRM-related nodes.

Step 3: Adjust Identifiers If Needed

  1. Confirm the email inboxes you monitor are correct in Gmail nodes.
  2. Check that contact IDs and fields align with your CRM setup.

Step 4: Review Prompt and Scripts

  1. Copy the OpenAI prompt below exactly into the OpenAI node for correct interest detection:
=You are the best sales development representative in the world. You send cold email messages daily to CEOs and founders of companies. You do this to persuade them to make contact. This could be a phone call or a video meeting.

Your task is to assess whether someone is interested in meeting up or calling sometime. You do this by attentively evaluating their response.

This is the email:
{{ $('Get email').item.json.text }}

The response format should be:
{"interested": [yes/no],
"reason": reason
}

JSON:
  1. Ensure the Code node uses this JavaScript snippet to parse OpenAI’s reply:
let interested = JSON.parse($json["message"]["content"]).interested;
let reason = JSON.parse($json["message"]["content"]).reason;

return {json: {interested: interested, reason: reason}};

Step 5: Test the Workflow

  1. Send a sample cold email reply to the monitored Gmail inbox.
  2. Watch the workflow run successfully in n8n’s execution log.
  3. Confirm a deal is created in Pipedrive when reply shows interest.

Step 6: Activate for Production

  1. Turn on the workflow in n8n to run continuously.
  2. If self hosting n8n, ensure your server has stable API access. Learn more about self-host n8n options.

Customizations and Extensions

  • Add more Gmail inbox nodes to monitor extra email accounts in parallel.
  • Modify the OpenAI prompt for your sales style or industry words.
  • Include fields like deal value or close dates in Pipedrive deal creation.
  • Add filters to skip auto-replies or irrelevant messages before OpenAI step.
  • Set up logging nodes to catch errors or invalid responses and alert you.

Common Edge Cases and Failures

  • No person found in Pipedrive: Email sender not matched to CRM contact.
    Make sure contact emails are updated and search term matches.
  • OpenAI response invalid JSON: Model reply not formatted correctly.
    Fix prompt or add error handling to retry.
  • No deal created after interest check: The interest value was not “yes”.
    Verify OpenAI output and conditions in IF nodes.

Pre-Production Checklist

  • Confirm Pipedrive API access and credentials.
  • Verify Gmail inbox connectivity.
  • Test OpenAI node with sample replies and check response format.
  • Ensure in_campaign field exists and is populated in Pipedrive.
  • Run several test replies through a dry run.
  • Backup CRM data before working with live large campaigns.

Deployment Notes

Keep the workflow active in n8n to run automatically.
If running the workflow on your own server, ensure constant API access to Gmail, Pipedrive, and OpenAI.
Monitor jobs in n8n’s dashboard and fix any errors promptly.

Using self-host n8n helps to keep full control and privacy over data.


Summary

✓ The workflow automatically scans email replies.
✓ It finds matching contacts in Pipedrive CRM.
✓ It asks GPT-4 if the reply shows meeting interest.
✓ Only interested leads get deals created.
✓ You save time and reduce manual work.
✓ The sales pipeline grows without missed leads.


Frequently Asked Questions

No, the workflow depends on the Gmail Trigger node. To use other providers, the user must add or replace email trigger nodes that support those services.
Yes, calling the GPT-4 API consumes billable tokens based on usage and plan.
Data transfers use encrypted APIs. For more control, users can self-host n8n.
Yes, but users should monitor Gmail and OpenAI API rate limits to avoid throttling.

Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation Workflows in n8n

A complete beginner guide to building an AI SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free