How to Build an AI-Powered Inbound Lead Qualification Flow with Claude and Perplexity

How I Built an AI-Powered Inbound Lead Qualification Flow (So You Can Too)
If you've ever wanted to catch inbound leads, qualify them like a sales genius, reply instantly with a friendly well-researched custom email, and send the processed inbound directly to your team on Slack and Discord without having to lift a finger — welcome! This tutorial is for you.
This is a step-by-step breakdown of what I built in this video and how you can recreate it with Activepieces, ChatGPT, Claude, Perplexity, and Google Sheets.
If you have any trouble following along, just ask ChatGPT to help! Give ChatGPT a link to this article and the Activepieces documentation and it will help you out way better than any Vibe Coder ever could.
The Activepieces AI Qualification Inbound Flow Template is here. Using this template will do most of the work for you!
And now, hold onto your butts. We're going to build an Agentic AI Flow in Activepieces that:
- ✉️ Captures leads from an inbound form on a Netlify-hosted websitesite
- 🧹 Researches the company with Perplexity
- 🧰 Scores the lead priority with Claude based on Perplexity's research
- 📅 Flags spam (also Claude, because he’s judgy)
- 📨 Responds automatically with a custom message in Gmail (hey look it's Claude again)
- 📈 Logs it all to Google Sheets
- 🚨 Sends the qualified inbound to Discord or Slack
🔍 Step 1: Catch the Inbound with a Webhook
Create a new Flow in Activepieces and set the trigger to Catch Webhook. This will let your website talk to your flow.
Don't share your webhook URL publicly. Treat it like your debit card PIN, except it sends data instead of money.
Create a new website with ChatGPT (Optional)
- Tell ChatGPT you want to create a simple but good looking website that is just an Inbound Form and a privacy policy.
- The inbound form should fields
name
,email
,company
, andmessage
- Make all fields required
- Give ChatGPT your webhook URL and tell it to POST the inbound form fields to the webhook
- You can make the website as complicated as you want as long as ChatGPT knows to send the inbound form data to your webhook
- Have ChatGPT give you a .zip of the website
- Get a free Netlify account and simply drop the unzipped folder into Netlify Drop
- Your beautiful new website is live 🎉
OR
Update an existing inbound form with your Webhook URL
- Give ChatGPT your inbound form page website code (if you're ok with that) and ask it to POST the form data to your Activepieces webhook URL
- Update your website code with the new JavaScript and test it out
- You can also use Cursor or Claude to update your website's code
- If you somehow know how to code, you can just do this yourself! But if you know how to code JavaScript, then why are you reading this tutorial I wonder?
Here's the JS snippet we used:
const form = document.getElementById("contact-form");
form.addEventListener("submit", function(e) {
e.preventDefault();
const formData = new FormData(form);
const data = {};
formData.forEach((value, key) => data[key] = value);
fetch("https://cloud.activepieces.com/api/v1/webhooks/XXXXXXXXXXXX", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(data)
}).then(() => {
alert("Form submitted!");
form.reset();
}).catch(err => {
console.error("Webhook failed", err);
alert("Something went wrong. Try again.");
});
});
🦜 Step 2: Research the Company with Perplexity
Add the Perplexity AI step in Activepieces.
Now, connect Perplexity to Activepieces:
Note: Perplexity is extremely good at this kind of research, but if you don't have Perplexity Pro, then you can do this research step with an Ask AI
step in Activepieces and use Claude or ChatGPT to research the company using the built-in Activepieces connection.
- Go to Perplexity Settings (you must have Perplexity Pro to get an API key)
- Click Generate API Key
- In Activepieces, go to Connections → Add Connection → Perplexity
- Paste your new API Key into the Activepieces API Key window
✅ You’re now connected to Perplexity and ready to automate company research.
Use this Prompt in your Perplexity step:
What does the company {{trigger.body.company}} do? Keep it under 3 sentences and include company size, how popular they are, profitability, funding, and other important details. Do not include any citations in your result.
Note: whenever you see something like {{trigger.body.company}}
in this tutorial, you can also use the visual UI in Activepieces to connect the output of the desired step to the input of the step you're working on. That's almost easier than copy-pasting.
This Perplexity output will be used in the following Claude steps.
🧠 Step 3: Score Priority with Claude (Ask AI)
Add an Ask AI step. Choose Anthropoic as the provider and claude-3-7-sonnet
(or any other model you prefer) as the model.
Prompt:
Based on the information below, return only the priority of this lead.
Company Name: {{trigger.body.company}}
Company Information: {{step_5['result']}}
Message: {{trigger.body.message}}
Country: {{trigger.headers[\"cf-ipcountry\"]}}
Use the following rules:
- 1–10 employees = Low
- 11–150 = Medium
- 151–500 = High
- 501+ or widely known = 🔥Flaming Hot🔥
Take into account whether the company has lots of funding, is very profitable, or is very high-profile based on the Company Info, and adjust the priority accordingly.
Also take into account whether the message seems urgent (they need help right now) or is more exploratory (the odds of closing a deal are low).
Return only one of:
Low, Medium, High, 🔥Flaming Hot🔥
This feeds the company research from Perplexity and the lead’s original message into Claude.
Claude returns a one-word result like: High
❌ Step 4: Filter Spam with Claude
Add another Ask AI step (Claude). Prompt:
Decide if the following form submission looks like spam.
Use these fields:
- Message: {{trigger.body.message}}
- Email: {{trigger.body.email}}
- Country: {{trigger.headers[\"cf-ipcountry\"]}}
- Company Name: {{trigger.body.company}}
Spam indicators include:
- Irrelevant or salesy messages
- Obvious spam
- Gibberish
- Malicious links
- Suspicious or fake-looking emails (e.g. noreply@, weird domains)
Return only one word:
true (if it's spam) or false (if it's legit)
You’ll branch the flow based on this true
or false
result.
📆 Step 5: Get Current Timestamp
Add a Date Helper Get Current Date
step after our spam filter. Choose your desired timestamp format and select the correct timezone.
Use the result of this step to timestamp your Google Sheets logs.
🔀 Step 6: Add Branching Logic to Filter Spam
Use a Router step:
- if
spam filter output
text containstrue
→ log to Google Sheets “Spam” tab (Step 7) → END else
→ continue flow
🐷 Step 7: Log Spam
Add a Google Sheets step on the left side of the Router and connect your Google Sheets account to Activepieces. Create a sheet in your Google Drive called something like Inbound Qualification Flow
. Add a Spam
sheet tab and an Inbound
sheet tab to this sheet. In the top row of each sheet, add the columns:
Name
Email
Company
Company Info
Message
Country
Timestamp
Spam
Priority
tl;dr
Response
Select the Spam sheet in your Log Spam
step and turn on Does the first row contain headers?
then plug in the output from the relevant previous steps into each column. You'll do the same for the Inbound sheet later on.
This keeps garbage out of your inbox, but makes sure the supposed spam is still logged somewhere just in case a late Nigerian prince actually does want to leave you his entire fortune.
💬 Step 8: Claude TL;DR Summary
Add another Ask AI step and choose Claude. Prompt:
Summarize this inbound lead in one fun, informal sentence that captures the essence of who they are and what they want.
Company: {{trigger.body.company}}
Company info: {{step_5['result']}}
Message: {{trigger.body.message}}
Country: {{trigger.headers[\"cf-ipcountry\"]}}
Priority: {{step_4}}
Examples:
"An enterprise company with 500+ employees wants us to rebuild their website!"
"A tiny indie dev wants to vibe code their new app."
"A massive logistics firm that focuses on pharma wants automation help — like yesterday."
"A spammy NFT guy tried to slide into the inbox. Again."
Keep it short, human, and punchy. Return only the sentence.
Result: a punchy one-liner for Sheets, Slack, and Discord for anyone who hates reading.
✍️ Step 9: Claude Generates a Custom Email Response
Add yet another Ask AI step and choose Claude yet again. Oh Claude, you're my only friend...I'm ChatGPT's friend but ChatGPT isn't my friend.
Prompt for Claude:
Write a short, friendly email response to this inbound lead.
Use the following:
- Name: {{trigger.body.name}}
- Company: {{trigger.body.company}}
- Company Info: {{step_5['result']}}
- Message: {{trigger.body.message}}
Keep the message:
- 2–3 sentences
- Conversational and casual
- Friendly and not too formal
- Don't promise anything
Do not include links or calls to action. Don't say anything too weird.
Return only the body of the email.
Claude responds with a warm and well-informed 2–3 sentence email that (hopefully) won't destroy the planet.
📧 Step 10: Gmail Sends the Response Email Automatically
Add a Gmail step:
- To:
{{trigger.body.email}}
- Subject:
Thanks for reaching out 🚀
- Body:
{{steps.claude_reply.text}}
Boom. Instant AI-powered response.
Bonus points: Create another Ask AI step before this step to generate a custom subject line for each email response.
📊 Step 11: Log Inbounds to Google Sheets
Add a Google Sheets step and log the following to your Inbounds sheet, just like we did with the Spam sheet:
Name
Email
Company
Company Info
Message
Country
Timestamp
Spam
Priority
tl;dr
Response
You can reference this sheet to see what message Claude automatically sent your lead, in case they don't respond to it (but come one, they're gonna respond).
🔔 Step 12: Broadcast to Discord
If your company uses Discord, this is the easiest way to send the processed lead to a Discord channel:
Add an HTTP Request step in Activepieces.
- Method: POST
- URL: Your private Discord webhook (don’t share it)
How to get the Discord webhook url:
- Open Discord and go to the server where you want to send messages.
- In the sidebar, click Integrations.
- Click Create Webhook.
- Give your webhook a name (like Inbound Bot).
- Choose the channel where you want your Inbound message to be sent (or create a #hot-inbounds channel).
- Click Copy Webhook URL — this is the URL you’ll paste into Activepieces.
- Save changes if needed, paste the URL into the Activepieces HTTP step, and you're done!
Important: Keep your webhook URL private — anyone who has it can send messages into your Discord server. And that can end up really bad if your URL falls into the wrong hands.
You don't need any coding to use this webhook — just a simple HTTP POST in Activepieces.
Headers:
Content-Type
– application/json
Body Type:
JSON
JSON Body:
{
"content": "📥 **New Vibe Lead!**\n👤 **Name:** {{trigger.body.name}}\n📧 **Email:** {{trigger.body.email}}\n🏢 **Company:** {{trigger.body.company}}\n🌍 **Country:** {{trigger.headers[\"cf-ipcountry\"]}}\n📝 **Message:** {{trigger.body.message}}\n🔥 **Priority:** {{step_4}}\n🧾 **Company Info:** {{step_5['result']}}\n🧠 **TL;DR:** {{step_10}}{{steps.ask_ai.text}}"
}
💬 Step 13: Broadcast to Slack
If your company uses Slack, use this method:
Add the step Slack → Send Message to Channel in Activepieces.
- Channel: #hot-inbounds (or whatever)
Message:
📥 *New Vibe Lead!*
*👤 Name:* {{trigger.body.name}}
*📧 Email:* {{trigger.body.email}}
*🏢 Company:* {{trigger.body.company}}
*🌍 Country:* {{trigger.headers[\"cf-ipcountry\"]}}
*📝 Message:* {{trigger.body.message}}
*ℹ️ Company Info:* {{step_5['result']}}
🔥 *Priority:* {{step_4}}
🧠 *TL;DR:* {{step_10}}"
Note: If any of the {{step}} inputs aren't working, just add them visually in the Activepieces UI from previous step outputs. It's so easy even a Vibe Coder could do it!
Make sure the Slack bot is invited to the channel (/invite @your-bot
) - otherwise the Slack bot won't work!
🎉 Done & Deployed 🎉
You've now got an amazing flow in Activepieces that:
- Catches leads
- Executes deep research on the company
- Assigns a priority to the inbound with Artificial Intelligence
- Filters spam
- Replies immediately with a human-seeming AI response
- Logs the inbound & notifies your team in Slack and Discord
For vibe-coded consulting, make sure to reach out to the Vibe Coder at: https://vibecodeenterprises.netlify.app/
This Flow was built with Activepieces, Claude, Perplexity, and ✨ unreasonable confidence ✨