> ## Documentation Index
> Fetch the complete documentation index at: https://developers.explorium.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Explorium Prospects Search Chatbot

> An intelligent conversational interface that translates natural language queries into Explorium API calls to find B2B prospects and export them as CSV files. ##

## Template

Download the following json file and import it to a new n8n workflow:

<Columns cols={2}>
  <Card size={22} icon="rocket-launch" horizontal title="mcp_to_prospects_to_csv.json" href="https://drive.usercontent.google.com/u/0/uc?id=1_TO79jMUJxaDt5s2PAI2RYHOpB-7xPwD&export=download" />
</Columns>

<Frame>
  <img src="https://mintcdn.com/explorium/TmftfUQ2HnGT0gSe/images/reference/7d8d1a8a648e41b07f704212ebbbd392c38082aeffb70c23a4981c8ec0e03e0d-image.png?fit=max&auto=format&n=TmftfUQ2HnGT0gSe&q=85&s=2ed87ef393246075f4675c26f24f61cd" alt="" width="1492" height="305" data-path="images/reference/7d8d1a8a648e41b07f704212ebbbd392c38082aeffb70c23a4981c8ec0e03e0d-image.png" />
</Frame>

## Overview

This n8n workflow creates a chatbot that understands natural language requests for finding business prospects and automatically:

* Interprets your query using AI (Claude Sonnet 3.7)
* Converts it to proper Explorium API filters
* Validates the API request structure
* Fetches prospect data from Explorium
* Exports results as a downloadable CSV file

Perfect for sales teams, recruiters, and business development professionals who need to quickly find and export targeted prospect lists without learning complex API syntax.

## Key Features

* **Natural Language Interface**: Simply describe who you're looking for in plain English
* **Smart Query Translation**: AI converts your request to valid API parameters
* **Built-in Validation**: Ensures API calls meet Explorium's requirements
* **Error Recovery**: Automatically retries with corrections if validation fails
* **Pagination Support**: Handles large result sets automatically
* **CSV Export**: Clean, formatted output ready for CRM import
* **Conversation Memory**: Maintains context for follow-up queries

## Example Queries

The chatbot understands queries like:

* "Find marketing directors at SaaS companies in New York with 50-200 employees"
* "Get me CTOs from fintech startups in California"
* "Show me sales managers at healthcare companies with revenue over \$10M"
* "Find engineers at Microsoft with 3-5 years experience"
* "Get customer service leads from e-commerce companies in Europe"

## Prerequisites

Before setting up this workflow, ensure you have:

1. **n8n instance** with chat interface enabled
2. **Anthropic API key** for Claude
3. **Explorium API credentials** (API Key)
4. Basic understanding of n8n chat workflows

## Supported Filters

The chatbot can search using these criteria:

### Company Filters

* **Size**: 1-10, 11-50, 51-200, 201-500, 501-1000, 1001-5000, 5001-10000, 10001+ employees
* **Revenue**: Ranges from $0-500K up to $10T+
* **Age**: 0-3, 3-6, 6-10, 10-20, 20+ years
* **Location**: Countries, regions, cities
* **Industry**: Google categories, NAICS codes, LinkedIn categories
* **Name**: Specific company names

### Prospect Filters

* **Job Level**: CXO, VP, Director, Manager, Senior, Entry, etc.
* **Department**: Sales, Marketing, Engineering, Finance, HR, etc.
* **Experience**: Total months and current role duration
* **Location**: Country and region codes
* **Contact Info**: Filter by email/phone availability

## Installation & Setup

### Step 1: Import the Workflow

<Steps>
  <Step>
    Create a new workflow.
  </Step>

  <Step>
    Download the workflow JSON from above.
  </Step>

  <Step>
    In your n8n instance, go to **Workflows** <Icon icon="arrow-right" /> **Add Workflow** <Icon icon="arrow-right" /> **Import from File**
  </Step>

  <Step>
    Select the JSON file and click **Import**
  </Step>
</Steps>

### Step 2: Configure Anthropic Credentials

<Steps>
  <Step>
    Click on the **Anthropic Chat Model1** node
  </Step>

  <Step>
    Under Credentials, click **Create New**
  </Step>

  <Step>
    Add your Anthropic API key
  </Step>

  <Step>
    Name: "Anthropic API"
  </Step>

  <Step>
    Save credentials
  </Step>
</Steps>

### Step 3: Configure Explorium Credentials

You'll need to set up Explorium credentials in two places:

#### For MCP Client:

<Steps>
  <Step>
    Click on the **MCP Client** node
  </Step>

  <Step>
    Under Credentials, create new **Header Auth**
  </Step>

  <Step>
    Configure the header:

    1. **Name**: `api_key`
    2. **Value**: `YOUR_EXPLORIUM_API_TOKEN`
  </Step>

  <Step>
    Save credentials

    <Frame>
      <img src="https://mintcdn.com/explorium/TmftfUQ2HnGT0gSe/images/reference/8b89ad77232f806faab6590caca7dacc7a673f61ba10275f75e5bfec202fdbd5-image.png?fit=max&auto=format&n=TmftfUQ2HnGT0gSe&q=85&s=37ed830df917eaa56abc4ad8da5285cb" alt="" width="1988" height="910" data-path="images/reference/8b89ad77232f806faab6590caca7dacc7a673f61ba10275f75e5bfec202fdbd5-image.png" />
    </Frame>
  </Step>
</Steps>

#### For API Calls:

<Steps>
  <Step>
    Click on the **Prospects API Call** node
  </Step>

  <Step>
    Use the same Header Auth credentials created above
  </Step>

  <Step>
    Verify the API endpoint is correct
  </Step>
</Steps>

### Step 4: Activate the Workflow

<Steps>
  <Step>
    Save the workflow
  </Step>

  <Step>
    Click the **Active** toggle to enable it
  </Step>

  <Step>
    The chat interface will now be available
  </Step>
</Steps>

### Step 5: Access the Chat Interface

<Steps>
  <Step>
    Click on the **When chat message received** node
  </Step>

  <Step>
    Copy the webhook URL
  </Step>

  <Step>
    Access this URL in your browser to start chatting
  </Step>
</Steps>

## How It Works

### Workflow Architecture

1. **Chat Trigger**: Receives natural language queries from users
2. **Memory Buffer**: Maintains conversation context
3. **AI Agent**: Interprets queries and generates API parameters
4. **Validation**: Checks API structure against Explorium requirements
5. **API Call**: Fetches prospect data with pagination
6. **Data Processing**: Formats results for CSV export
7. **File Conversion**: Creates downloadable CSV file

### Processing Flow

```
User Query <Icon icon="arrow-right" /> AI Interpretation <Icon icon="arrow-right" /> Validation <Icon icon="arrow-right" /> API Call <Icon icon="arrow-right" /> CSV Export
     ↑                                  ↓
     └──── Error Correction Loop ←──────┘
```

### Validation Rules

The workflow validates:

* Filter keys are allowed by Explorium API
* Values match expected formats (e.g., valid country codes)
* Range filters have proper gte/lte values
* No duplicate values in arrays
* Required structure is maintained

## Usage Guide

### Basic Conversation Flow

<Steps>
  <Step title="Start with your query">
    ```
    "Find me VPs of Sales at software companies in the US"
    ```
  </Step>

  <Step title="Bot processes and responds">
    * Generates API filters
    * Validates the structure
    * Fetches data
    * Returns CSV download link
  </Step>

  <Step title="Refine if needed">
    ```
    "Can you also include directors and filter for companies with 100+ employees?"
    ```
  </Step>
</Steps>

### Query Tips

* **Be specific**: Include job titles, departments, company details
* **Use standard terms**: "CTO" instead of "Chief Technology Officer"
* **Specify locations**: Use country names or standard codes
* **Include size/revenue**: Helps narrow results effectively

### Advanced Queries

Combine multiple criteria:

```
"Find engineering managers and senior engineers at B2B SaaS companies
in New York and California with 50-500 employees and revenue over $5M
who have been in their role for at least 1 year"
```

## Output Format

The CSV file includes:

* Prospect ID
* Name (first, last, full)
* Location (country, region, city)
* LinkedIn profile
* Experience summary
* Skills and interests
* Company details
* Job information
* Business ID

## Troubleshooting

### Common Issues

**"Validation failed" errors**

* Check that your query uses supported filter values
* Ensure location names are spelled correctly
* Verify company sizes/revenues match allowed ranges

**No results returned**

* Broaden your search criteria
* Check if the company exists in Explorium's database
* Verify filter combinations aren't too restrictive

**Chat not responding**

* Ensure workflow is activated
* Check all credentials are properly configured
* Verify webhook URL is accessible

**Large result sets timing out**

* Try adding more specific filters
* Limit results by location or company size
* Use the size parameter (max 10,000)

### Error Messages

The bot provides clear feedback:

* **Invalid filters**: Shows which filters aren't supported
* **Value errors**: Lists correct options for each field
* **API failures**: Explains connection or authentication issues

## Performance Optimization

### Best Practices

1. **Start broad, then narrow**: Begin with basic criteria and add filters
2. **Use business IDs**: When targeting specific companies
3. **Limit by contact info**: Add `has_email: true` for actionable leads
4. **Batch by location**: Process regions separately for large searches

### API Limits

* Maximum 10,000 results per search
* Pagination handles up to 100 records per page
* Rate limits apply based on your Explorium subscription

## Customization Options

### Modify AI Behavior

Edit the **AI Agent** system message to:

* Change response format
* Add custom filters
* Adjust interpretation logic
* Include additional instructions

### Extend Functionality

Add nodes to:

* Send results via email
* Import directly to CRM
* Schedule recurring searches
* Create custom reports

### Integration Ideas

* Connect to Slack for team queries
* Add to CRM workflows
* Create lead scoring systems
* Build automated outreach campaigns

## Security Considerations

* API credentials are stored securely in n8n
* Chat sessions are isolated
* No prospect data is stored permanently
* CSV files are generated on-demand

## Support Resources

For issues with:

* **n8n platform**: Check n8n documentation
* **Explorium API**: Contact Explorium support
* **Anthropic/Claude**: Refer to Anthropic docs
* **Workflow logic**: Review node configurations
