Qualify leads with Salesforce, Explorium data & Claude AI analysis of API usage
Inbound Agent - AI-Powered Lead Qualification with Product Usage Intelligence
This n8n workflow automatically qualifies and scores inbound leads by combining their product usage patterns with deep company intelligence. The workflow pulls new leads from your CRM, analyzes which API endpoints they've been testing, enriches them with firmographic data, and generates comprehensive qualification reports with personalized talking points—giving your sales team everything they need to prioritize and convert high-quality leads.
DEMO
Credentials Required
To use this workflow, set up the following credentials in your n8n environment:
Salesforce
- Type: OAuth2 or Username/Password
- Used for: Pulling lead reports and creating follow-up tasks
- Alternative CRM options: HubSpot, Zoho, Pipedrive
- Get credentials at Salesforce Setup
Databricks (or Analytics Platform)
- Type: HTTP Request with Bearer Token
- Header:
Authorization - Value:
Bearer YOUR_DATABRICKS_TOKEN - Used for: Querying product usage and API endpoint data
- Alternative options: Datadog, Mixpanel, Amplitude, custom data warehouse
Explorium API
- Type: Generic Header Auth
- Header:
Authorization - Value:
Bearer YOUR_API_KEY - Used for: Business matching and firmographic enrichment
- Get your API key at Explorium Dashboard
Explorium MCP
- Type: HTTP Header Auth
- Used for: Real-time company intelligence and supplemental research
- Connect to:
https://mcp.explorium.ai/mcp
Anthropic API
- Type: API Key
- Used for: AI-powered lead qualification and analysis
- Get your API key at Anthropic Console
Go to Settings → Credentials, create these credentials, and assign them in the respective nodes before running the workflow.
Workflow Overview
Node 1: When clicking 'Execute workflow'
Manual trigger that initiates the lead qualification process.
- Type: Manual Trigger
- Purpose: On-demand execution for testing or manual runs
Alternative Trigger Options:
- Schedule Trigger: Run automatically (hourly, daily, weekly)
- Webhook: Trigger on CRM updates or new lead events
- CRM Trigger: Real-time activation when leads are created
Node 2: GET SF Report
Pulls lead data from a pre-configured Salesforce report.
- Method: GET
- Endpoint: Salesforce Analytics Reports API
- Authentication: Salesforce OAuth2
Returns: Raw Salesforce report data including:
- Lead contact information
- Company names
- Lead source and status
- Created dates
- Custom fields
CRM Alternatives: This node can be replaced with HubSpot, Zoho, or any CRM's reporting API.
Node 3: Extract Records
Parses the Salesforce report structure and extracts individual lead records.
Extraction Logic:
- Navigates report's
factMap['T!T'].rowsstructure - Maps data cells to named fields
Node 4: Extract Tenant Names
Prepares tenant identifiers for usage data queries.
Purpose: Formats tenant names as SQL-compatible strings for the Databricks query
Output: Comma-separated, quoted list: 'tenant1', 'tenant2', 'tenant3'
Node 5: Query Databricks
Queries your analytics platform to retrieve API usage data for each lead.
- Method: POST
- Endpoint:
/api/2.0/sql/statements - Authentication: Bearer token in headers
- Warehouse ID: Your Databricks cluster ID
Platform Alternatives:
- Datadog: Query logs via Logs API
- Mixpanel: Event segmentation API
- Amplitude: Behavioral cohorts API
- Custom Warehouse: PostgreSQL, Snowflake, BigQuery queries
Node 6: Split Out
Splits the Databricks result array into individual items for processing.
- Field:
result.data_array - Purpose: Transform single response with multiple rows into separate items
Node 7: Rename Keys
Normalizes column names from database query to readable field names.
Mapping:
0→TenantNames1→endpoints2→endpointsNum
Node 8: Extract Business Names
Prepares company names for Explorium enrichment.
Node 9: Loop Over Items
Iterates through each company for individual enrichment.
Node 10: Explorium API: Match Businesses
Matches company names to Explorium's business entity database.
- Method: POST
- Endpoint:
/v1/businesses/match - Authentication: Header Auth (Bearer token)
Returns:
business_id: Unique Explorium identifiermatched_businesses: Array of potential matches- Match confidence scores
Node 11: Explorium API: Firmographics
Enriches matched businesses with comprehensive company data.
- Method: POST
- Endpoint:
/v1/businesses/firmographics/bulk_enrich - Authentication: Header Auth (Bearer token)
Returns:
- Company name, website, description
- Industry categories (NAICS, SIC, LinkedIn)
- Size: employee count range, revenue range
- Location: headquarters address, city, region, country
- Company age and founding information
- Social profiles: LinkedIn, Twitter
- Logo and branding assets
Node 12: Merge
Combines API usage data with firmographic enrichment data.
Node 13: Organize Data as Items
Structures merged data into clean, standardized lead objects.
Data Organization:
- Maps API usage by tenant name
- Maps enrichment data by company name
- Combines with original lead information
- Creates complete lead profile for analysis
Node 14: Loop Over Items1
Iterates through each qualified lead for AI analysis.
- Batch Size: 1 (analyzes leads individually)
- Purpose: Generate personalized qualification reports
Node 15: Get many accounts1
Fetches the associated Salesforce account for context.
- Resource: Account
- Operation: Get All
- Filter: Match by company name
- Limit: 1 record
Purpose: Link lead qualification back to Salesforce account for task creation
Node 16: AI Agent
Analyzes each lead to generate comprehensive qualification reports.
Input Data:
- Lead contact information
- API usage patterns (which endpoints tested)
- Firmographic data (company profile)
- Lead source and status
Analysis Process:
- Evaluates lead quality based on usage, company fit, and signals
- Identifies which Explorium APIs the lead explored
- Assesses company size, industry, and potential value
- Detects quality signals (legitimate company email, active usage) and red flags
- Determines optimal sales approach and timing
- Connected to Explorium MCP for supplemental company research if needed
Output: Structured qualification report with:
- Lead Score: High Priority, Medium Priority, Low Priority, or Nurture
- Quick Summary: Executive overview of lead potential
- API Usage Analysis: Endpoints used, usage insights, potential use case
- Company Profile: Overview, fit assessment, potential value
- Quality Signals: Positive indicators and concerns
- Recommended Actions: Next steps, timing, and approach
- Talking Points: Personalized conversation starters based on actual API usage
Node 18: Clean Outputs
Formats the AI qualification report for Salesforce task creation.
Node 19: Update Salesforce Records
Creates follow-up tasks in Salesforce with qualification intelligence.
- Resource: Task
- Operation: Create
- Authentication: Salesforce OAuth2
Alternative Output Options:
- HubSpot: Create tasks or update deal stages
- Outreach/SalesLoft: Add to sequences with custom messaging
- Slack: Send qualification reports to sales channels
- Email: Send reports to account owners
- Google Sheets: Log qualified leads for tracking
Workflow Flow Summary
- Trigger: Manual execution or scheduled run
- Pull Leads: Fetch new/updated leads from Salesforce report
- Extract: Parse lead records and tenant identifiers
- Query Usage: Retrieve API endpoint usage data from analytics platform
- Prepare: Format data for enrichment
- Match: Identify companies in Explorium database
- Enrich: Pull comprehensive firmographic data
- Merge: Combine usage patterns with company intelligence
- Organize: Structure complete lead profiles
- Analyze: AI evaluates each lead with quality scoring
- Format: Structure qualification reports for CRM
- Create Tasks: Automatically populate Salesforce with actionable intelligence
This workflow eliminates manual lead research and qualification, automatically analyzing product engagement patterns alongside company fit to help sales teams prioritize and personalize their outreach to the highest-value inbound leads.
Customization Options
Flexible Triggers
Replace the manual trigger with:
- Schedule: Run hourly/daily to continuously qualify new leads
- Webhook: Real-time qualification when leads are created
- CRM Trigger: Activate on specific lead status changes
Analytics Platform Integration
The Databricks query can be adapted for:
- Datadog: Query application logs and events
- Mixpanel: Analyze user behavior and feature adoption
- Amplitude: Track product engagement metrics
- Custom Databases: PostgreSQL, MySQL, Snowflake, BigQuery
CRM Flexibility
Works with multiple CRMs:
- Salesforce: Full integration (pull reports, create tasks)
- HubSpot: Contact properties and deal updates
- Zoho: Lead enrichment and task creation
- Pipedrive: Deal qualification and activity creation
Enrichment Depth
Add more Explorium endpoints:
- Technographics: Tech stack and product usage
- News & Events: Recent company announcements
- Funding Data: Investment rounds and financial events
- Hiring Signals: Job postings and growth indicators
Output Destinations
Route qualification reports to:
- CRM Updates: Salesforce, HubSpot (update lead scores/fields)
- Task Creation: Any CRM task/activity system
- Team Notifications: Slack, Microsoft Teams, Email
- Sales Tools: Outreach, SalesLoft, Salesloft sequences
- Reporting: Google Sheets, Data Studio dashboards
AI Model Options
Swap AI providers:
- Default: Anthropic Claude (Sonnet 4)
- Alternatives: OpenAI GPT-4, Google Gemini
Setup Notes
- Salesforce Report Configuration: Create a report with required fields (name, email, company, tenant ID) and use its API endpoint
- Tenant Identification: Ensure your product usage data includes identifiers that link to CRM leads
- Usage Data Query: Customize the SQL query to match your database schema and table structure
- MCP Configuration: Explorium MCP requires Header Auth—configure credentials properly
- Lead Scoring Logic: Adjust AI system prompts to match your ideal customer profile and qualification criteria
- Task Assignment: Configure Salesforce task assignment rules or add logic to route to specific sales reps
This workflow acts as an intelligent lead qualification system that combines behavioral signals (what they're testing) with firmographic fit (who they are) to give sales teams actionable intelligence for every inbound lead.
Qualify Leads with Salesforce, Explorium Data, and Claude AI Analysis
This n8n workflow automates the process of enriching and qualifying leads by integrating data from Salesforce, an external data source (via a generic HTTP request, potentially Explorium), and then using Claude AI to analyze the combined data for lead qualification. It intelligently routes leads based on the AI's assessment and updates Salesforce accordingly.
What it does
This workflow performs the following key steps:
- Manual Trigger: The workflow is initiated manually, allowing for on-demand lead qualification.
- Fetch Lead Data: It retrieves lead information from Salesforce.
- Enrich Lead Data: It makes an HTTP request to an external API (e.g., Explorium) to gather additional data for each lead.
- Combine Data: The fetched Salesforce and external data are merged to create a comprehensive profile for each lead.
- AI Analysis with Claude: An AI Agent, powered by an Anthropic Chat Model (Claude), analyzes the combined lead data.
- Structured Output Parsing: The AI's analysis is parsed into a structured format to extract specific qualification metrics.
- Conditional Routing: Based on the AI's qualification, the workflow branches:
- Qualified Leads: If the AI deems a lead qualified, it updates the lead in Salesforce.
- Unqualified Leads: If the AI deems a lead unqualified, it also updates the lead in Salesforce, potentially marking it as "unqualified" or "needs review".
- Loop Over Items: The workflow processes leads in batches, ensuring efficient handling of multiple leads.
- Rename Keys: It renames data keys for consistency before and after processing.
- Code Node for Data Manipulation: Custom JavaScript code is used for specific data transformations or logic.
- MCP Client Tool: Utilizes a Model Context Protocol Client Tool, likely for advanced AI model interaction or data handling.
Prerequisites/Requirements
- n8n Instance: A running n8n instance.
- Salesforce Account: Configured Salesforce credentials in n8n.
- External Data API: Access to an external data enrichment API (e.g., Explorium), requiring an API key or authentication configured in the HTTP Request node.
- Anthropic (Claude) API Key: Credentials for the Anthropic Chat Model (Claude) to enable AI analysis.
- Model Context Protocol (MCP) Client: If the "MCP Client Tool" requires specific setup or credentials, these will be needed.
Setup/Usage
- Import the Workflow: Import the provided JSON into your n8n instance.
- Configure Credentials:
- Set up your Salesforce credentials in n8n.
- Configure the HTTP Request node (Node 19) with the URL and any necessary authentication for your external data source (e.g., Explorium).
- Add your Anthropic (Claude) API Key to the "Anthropic Chat Model" node (Node 1145) credentials.
- Review and Adjust Nodes:
- Salesforce Nodes: Ensure the Salesforce nodes (e.g., for fetching and updating leads) are configured with the correct objects, fields, and query parameters relevant to your Salesforce instance.
- HTTP Request Node: Verify the URL, method, headers, and body for the external data enrichment API call.
- AI Agent Node: Review the prompt and instructions given to the AI Agent (Node 1119) to ensure it performs the desired lead qualification analysis.
- Structured Output Parser: Adjust the schema in this node (Node 1179) to match the expected structured output from the AI.
- If Node: Customize the conditions in the "If" node (Node 20) to accurately route leads based on the AI's qualification criteria.
- Code Nodes: If any "Code" nodes (Node 834) are present, understand their logic and modify them if your data structure or processing needs differ.
- Execute Workflow: Click "Execute Workflow" on the "Manual Trigger" node (Node 838) to run the workflow. Monitor the execution to ensure leads are being processed and updated correctly in Salesforce.
Related Templates
AI multi-agent executive team for entrepreneurs with Gemini, Perplexity and WhatsApp
This workflow is an AI-powered multi-agent system built for startup founders and small business owners who want to automate decision-making, accountability, research, and communication, all through WhatsApp. The “virtual executive team,” is designed to help small teams to work smarter. This workflow sends you market analysis, market and sales tips, It can also monitor what your competitors are doing using perplexity (Research agent) and help you stay a head, or make better decisions. And when you feeling stuck with your start-up accountability director is creative enough to break the barrier 🎯 Core Features 🧑💼 1. President (Super Agent) Acts as the main controller that coordinates all sub-agents. Routes messages, assigns tasks, and ensures workflow synchronization between the AI Directors. 📊 2. Sales & Marketing Director Uses SerpAPI to search for market opportunities, leads, and trends. Suggests marketing campaigns, keywords, or outreach ideas. Can analyze current engagement metrics to adjust content strategy. 🕵️♀️ 3. Business Research Director Powered by Perplexity AI for competitive and market analysis. Monitors competitor moves, social media engagement, and product changes. Provides concise insights to help the founder adapt and stay ahead. ⏰ 4. Accountability Director Keeps the founder and executive team on track. Sends motivational nudges, task reminders, and progress reports. Promotes consistency and discipline — key traits for early-stage success. 🗓️ 5. Executive Secretary Handles scheduling, email drafting, and reminders. Connects with Google Calendar, Gmail, and Sheets through OAuth. Automates follow-ups, meeting summaries, and notifications directly via WhatsApp. 💬 WhatsApp as the Main Interface Interact naturally with your AI team through WhatsApp Business API. All responses, updates, and summaries are delivered to your chat. Ideal for founders who want to manage operations on the go. ⚙️ How It Works Trigger: The workflow starts from a WhatsApp Trigger node (via Meta Developer Account). Routing: The President agent analyzes the incoming message and determines which Director should handle it. Processing: Marketing or sales queries go to the Sales & Marketing Director. Research questions are handled by the Business Research Director. Accountability tasks are assigned to the Accountability Director. Scheduling or communication requests are managed by the Secretary. Collaboration: Each sub-agent returns results to the President, who summarizes and sends the reply back via WhatsApp. Memory: Context is maintained between sessions, ensuring personalized and coherent communication. 🧩 Integrations Required Gemini API – for general intelligence and task reasoning Supabase- for RAG and postgres persistent memory Perplexity API – for business and competitor analysis SerpAPI – for market research and opportunity scouting Google OAuth – to connect Sheets, Calendar, and Gmail WhatsApp Business API – for message triggers and responses 🚀 Benefits Acts like a team of tireless employees available 24/7. Saves time by automating research, reminders, and communication. Enhances accountability and strategy consistency for founders. Keeps operations centralized in a simple WhatsApp interface. 🧰 Setup Steps Create API credentials for: WhatsApp (via Meta Developer Account) Gemini, Perplexity, and SerpAPI Google OAuth (Sheets, Calendar, Gmail) Create a supabase account at supabase Add the credentials in the corresponding n8n nodes. Customize the system prompts for each Director based on your startup’s needs. Activate and start interacting with your virtual executive team on WhatsApp. Use Case You are a small organisation or start-up that can not afford hiring; marketing department, research department and secretar office, then this workflow is for you 💡 Need Customization? Want to tailor it for your startup or integrate with CRM tools like Notion or HubSpot? You can easily extend the workflow or contact the creator for personalized support. Consider adjusting the system prompt to suite your business
🎓 How to transform unstructured email data into structured format with AI agent
This workflow automates the process of extracting structured, usable information from unstructured email messages across multiple platforms. It connects directly to Gmail, Outlook, and IMAP accounts, retrieves incoming emails, and sends their content to an AI-powered parsing agent built on OpenAI GPT models. The AI agent analyzes each email, identifies relevant details, and returns a clean JSON structure containing key fields: From – sender’s email address To – recipient’s email address Subject – email subject line Summary – short AI-generated summary of the email body The extracted information is then automatically inserted into an n8n Data Table, creating a structured database of email metadata and summaries ready for indexing, reporting, or integration with other tools. --- Key Benefits ✅ Full Automation: Eliminates manual reading and data entry from incoming emails. ✅ Multi-Source Integration: Handles data from different email providers seamlessly. ✅ AI-Driven Accuracy: Uses advanced language models to interpret complex or unformatted content. ✅ Structured Storage: Creates a standardized, query-ready dataset from previously unstructured text. ✅ Time Efficiency: Processes emails in real time, improving productivity and response speed. *✅ Scalability: Easily extendable to handle additional sources or extract more data fields. --- How it works This workflow automates the transformation of unstructured email data into a structured, queryable format. It operates through a series of connected steps: Email Triggering: The workflow is initiated by one of three different email triggers (Gmail, Microsoft Outlook, or a generic IMAP account), which constantly monitor for new incoming emails. AI-Powered Parsing & Structuring: When a new email is detected, its raw, unstructured content is passed to a central "Parsing Agent." This agent uses a specified OpenAI language model to intelligently analyze the email text. Data Extraction & Standardization: Following a predefined system prompt, the AI agent extracts key information from the email, such as the sender, recipient, subject, and a generated summary. It then forces the output into a strict JSON structure using a "Structured Output Parser" node, ensuring data consistency. Data Storage: Finally, the clean, structured data (the from, to, subject, and summarize fields) is inserted as a new row into a specified n8n Data Table, creating a searchable and reportable database of email information. --- Set up steps To implement this workflow, follow these configuration steps: Prepare the Data Table: Create a new Data Table within n8n. Define the columns with the following names and string type: From, To, Subject, and Summary. Configure Email Credentials: Set up the credential connections for the email services you wish to use (Gmail OAuth2, Microsoft Outlook OAuth2, and/or IMAP). Ensure the accounts have the necessary permissions to read emails. Configure AI Model Credentials: Set up the OpenAI API credential with a valid API key. The workflow is configured to use the model, but this can be changed in the respective nodes if needed. Connect the Nodes: The workflow canvas is already correctly wired. Visually confirm that the email triggers are connected to the "Parsing Agent," which is connected to the "Insert row" (Data Table) node. Also, ensure the "OpenAI Chat Model" and "Structured Output Parser" are connected to the "Parsing Agent" as its AI model and output parser, respectively. Activate the Workflow: Save the workflow and toggle the "Active" switch to ON. The triggers will begin polling for new emails according to their schedule (e.g., every minute), and the automation will start processing incoming messages. --- Need help customizing? Contact me for consulting and support or add me on Linkedin.
Send WooCommerce discount coupons to customers via WhatsApp using Rapiwa API
Who is this for? This workflow is ideal for WooCommerce store owners who want to automatically send promotional WhatsApp messages to their customers when new coupons are created. It’s designed for marketers and eCommerce managers looking to boost engagement, streamline coupon sharing, and track campaign performance effortlessly through Google Sheets. Overview This workflow listens for WooCommerce coupon creation events (coupon.created) and uses customer billing data to send promotional WhatsApp messages via the Rapiwa API. The flow formats the coupon data, cleans phone numbers, verifies WhatsApp registration with Rapiwa, sends the promotional message when verified, and logs each attempt to Google Sheets (separate sheets for verified/sent and unverified/not sent). What this Workflow Does Listens for new coupon creation events in WooCommerce via the WooCommerce Trigger node Retrieves all customer data from the WooCommerce store Processes customers in batches to control throughput Cleans and formats customer phone numbers for WhatsApp Verifies if phone numbers are valid WhatsApp accounts using Rapiwa API Sends personalized WhatsApp messages with coupon details to verified numbers Logs all activities to Google Sheets for tracking and analysis Handles both verified and unverified numbers appropriately Key Features Automated coupon distribution: Triggers when new coupons are created in WooCommerce Customer data retrieval: Fetches all customer information from WooCommerce Phone number validation: Verifies WhatsApp numbers before sending messages Personalized messaging: Includes customer name and coupon details in messages Dual logging system: Tracks both successful and failed message attempts Rate limiting: Uses batching and wait nodes to prevent API overload Data formatting: Structures coupon information for consistent messaging Google Sheet Column Structure A Google Sheet formatted like this ➤ sample The workflow uses a Google Sheet with the following columns to track coupon distribution: | name | number | email | address1 | couponCode | couponTitle | couponType | couponAmount | createDate | expireDate | validity | status | | ----------- | ------------- | --------------------------------------------------- | --------- | ---------- | -------------- | ---------- | ------------ | ------------------- | ------------------- | ---------- | -------- | | Abdul Mannan | 8801322827799 | contact@spagreen.net | mirpur-DOHS | 62dhryst | eid offer 2025 | percent | 20.00 | 2025-09-11 06:08:02 | 2025-09-15 00:00:00 | unverified | not sent | | Abdul Mannan | 8801322827799 | contact@spagreen.net | mirpur-DOHS | 62dhryst | eid offer 2025 | percent | 20.00 | 2025-09-11 06:08:02 | 2025-09-15 00:00:00 | verified | sent | Requirements n8n instance with the following nodes: WooCommerce Trigger, Code, SplitInBatches, HTTP Request, IF, Google Sheets, Wait WooCommerce store with API access Rapiwa account with API access for WhatsApp verification and messaging Google account with Sheets access Customer phone numbers in WooCommerce (stored in billing.phone field) Important Notes Phone Number Format: The workflow cleans phone numbers by removing all non-digit characters. Ensure your WooCommerce phone numbers are in a compatible format. API Rate Limits: Rapiwa and WooCommerce APIs have rate limits. Adjust batch sizes and wait times accordingly. Data Privacy: Ensure compliance with data protection regulations when sending marketing messages. Error Handling: The workflow logs unverified numbers but doesn't have extensive error handling. Consider adding error notifications for failed API calls. Message Content: The current message template references the first coupon only (coupons[0]). Adjust if you need to handle multiple coupons. Useful Links Dashboard: https://app.rapiwa.com Official Website: https://rapiwa.com Documentation: https://docs.rapiwa.com Support & Help WhatsApp: Chat on WhatsApp Discord: SpaGreen Community Facebook Group: SpaGreen Support Website: https://spagreen.net Developer Portfolio: Codecanyon SpaGreen