Leads Mail Trigger¶
Overview¶
The Leads Mail Trigger monitors a dedicated email address for lead submissions, automatically parsing lead information from incoming emails. This is perfect for receiving leads from platforms that send lead data via email rather than webhooks or APIs.
When to use this trigger:
- Receive leads from platforms that email lead data
- Process lead notifications from advertising platforms
- Import leads from email-based lead generation tools
- Parse structured lead emails automatically
- Handle lead notifications from partner sites
- Process leads from older systems without modern APIs
Quick Start¶
- Set up a dedicated email address for leads (e.g., leads@yourdomain.com)
- Connect the email account to BaseCloud
- Create a new workflow
- Add a Leads Mail Trigger as the first task
- Configure email parsing rules
- Map extracted fields to CRM data
- Save and enable the workflow
[SCREENSHOT NEEDED: Leads Mail Trigger task panel showing email parsing configuration]
Setting Up Lead Email Account¶
Create Dedicated Email Address¶
It's best practice to use a dedicated email for leads:
leads@yourdomain.comnewleads@yourdomain.comfacebook-leads@yourdomain.com
Why dedicated? - Easier filtering and parsing - Clear separation from other emails - Better tracking and monitoring - Avoids accidentally processing wrong emails
Connect Email Account¶
Same process as Email Trigger:
Gmail: 1. Click "Connect Gmail Account" 2. Authorize BaseCloud 3. Select the leads email account
Microsoft 365: 1. Click "Connect Microsoft Account" 2. Sign in and authorize 3. Select the mailbox
IMAP (Any Provider): 1. Enter IMAP settings 2. Host, port, username, password 3. Test connection
[SCREENSHOT NEEDED: Email account connection interface]
Configuring Lead Sources¶
Facebook Lead Ads¶
If receiving leads from Facebook Lead Ads via email notification:
Facebook Setup: 1. In Facebook Ads Manager, go to Lead Forms 2. Enable email notifications 3. Enter your leads email address 4. Facebook will send lead data in structured format
BaseCloud Configuration: - From Address: notification+*@facebookmail.com - Subject Contains: "new lead" - Parsing Template: Facebook Lead Ads
Google Ads Lead Form Extensions¶
Google Setup: 1. In Google Ads, set up Lead Form Extension 2. Enable email notifications 3. Enter your leads email address
BaseCloud Configuration: - From Address: *@google.com - Subject Contains: "lead form" - Parsing Template: Google Ads Leads
Custom Email Lead Formats¶
For partners or platforms sending leads in custom email formats:
- Receive sample lead email
- Identify pattern (plain text, HTML table, JSON, etc.)
- Create custom parsing rules
- Map fields to CRM
Email Parsing Rules¶
Structured Email (HTML Table)¶
Many platforms send leads in HTML tables:
<table>
<tr><td>Name:</td><td>John Smith</td></tr>
<tr><td>Email:</td><td>john@example.com</td></tr>
<tr><td>Phone:</td><td>+27123456789</td></tr>
<tr><td>Message:</td><td>Interested in your product</td></tr>
</table>
Parsing Configuration: - Field Pattern: <td>{field_name}:</td><td>{field_value}</td> - Extract: Name, Email, Phone, Message
Plain Text Email¶
New Lead Received
Name: John Smith
Email: john@example.com
Phone: +27123456789
Company: ABC Corp
Interest: Product Demo
Parsing Configuration: - Field Pattern: {field_name}: {field_value} - Line-by-line extraction
JSON Email¶
Some systems send JSON:
{
"lead": {
"first_name": "John",
"last_name": "Smith",
"email": "john@example.com",
"phone": "+27123456789"
}
}
Parsing Configuration: - Format: JSON - Map JSON paths to fields
CSV in Email Body¶
Parsing Configuration: - Format: CSV - First row as headers - Extract data row
Field Mapping¶
Map parsed fields to BaseCloud CRM fields:
| Email Field | CRM Field | Notes |
|---|---|---|
| Name / Full Name | Full Name | Split if needed |
| First Name | First Name | |
| Last Name | Last Name | |
| Email / Email Address | Required | |
| Phone / Mobile | Phone | Normalize format |
| Company / Business | Company Name | |
| Message / Comments | Notes | |
| Interest / Product | Custom: Interest | Create custom field |
| Source / Campaign | Custom: Lead Source | Tag or custom field |
Output Fields¶
The Leads Mail Trigger outputs parsed lead data:
Lead Information¶
| Field | Description | Example Value |
|---|---|---|
task_[ID]_lead_name | Contact name | John Smith |
task_[ID]_lead_email | Email address | john@example.com |
task_[ID]_lead_phone | Phone number | +27123456789 |
task_[ID]_lead_company | Company name | ABC Corp |
task_[ID]_lead_message | Message/notes | Interested in demo |
Source Information¶
| Field | Description | Example Value |
|---|---|---|
task_[ID]_source_platform | Where lead came from | Facebook Lead Ads |
task_[ID]_source_campaign | Campaign name | Spring 2024 Promo |
task_[ID]_source_email_from | Email sender | notification@facebookmail.com |
task_[ID]_received_at | When email received | 2024-02-08 14:30:00 |
Custom Fields¶
All mapped fields available:
Real-World Examples¶
Example 1: Facebook Lead to CRM¶
Trigger: Email from Facebook with new lead
Workflow: 1. Leads Mail Trigger - Parse Facebook lead email 2. Phone Formatter - Normalize phone number 3. Match to Client - Find/update contact 4. Edit Client - Add "Facebook Lead" tag and campaign source 5. Email - Send auto-response to lead 6. Email - Notify sales team 7. MySQL Query - Log lead in database
Example 2: Multi-Source Lead Aggregation¶
Multiple Workflows (one per source):
Workflow 1 - Facebook Leads: 1. Leads Mail Trigger - Facebook format 2. Tag with "Facebook"
Workflow 2 - Google Ads Leads: 1. Leads Mail Trigger - Google format 2. Tag with "Google Ads"
Workflow 3 - Partner Leads: 1. Leads Mail Trigger - Partner format 2. Tag with partner name
All converge to shared processing: 4. Match to Client 5. Lead qualification logic 6. Assign to appropriate sales rep
Example 3: Lead Scoring and Routing¶
Trigger: Any lead email
Workflow: 1. Leads Mail Trigger - Parse lead 2. Code Task - Calculate lead score based on: - Company size - Budget mentioned - Interest level - Source quality 3. Match to Client - Find existing contact 4. Edit Client - Store lead score 5. If Task - Route based on score: - High score (80+): Assign to senior sales rep, immediate notification - Medium score (50-79): Assign to standard rep, notify within 1 hour - Low score (below 50): Add to nurture sequence
Example 4: Lead Validation and Cleanup¶
Trigger: Lead email received
Workflow: 1. Leads Mail Trigger - Parse lead 2. Phone Formatter - Normalize phone 3. If Task - Validate email format 4. If Task - Check phone not empty 5. If Task - Check not duplicate (search CRM) 6. If all valid: - Match to Client - Find existing contact - Email - Send welcome email 7. If invalid: - Email - Alert admin of bad lead data
Example 5: Lead Enrichment¶
Trigger: Lead email with minimal data
Workflow: 1. Leads Mail Trigger - Parse basic lead info 2. Webhook Out - Call enrichment API (Clearbit, etc.) with email 3. Code Task - Merge enrichment data 4. Match to Client - Find existing contact with enriched data 5. Edit Client - Add all additional fields: - Company size - Industry - Location - Social profiles 6. Email - Send personalized follow-up using enriched data
Handling Malformed Emails¶
Validation Steps¶
Always validate parsed data:
-
Email Format Check:
-
Phone Number Check:
-
Required Fields Check:
Error Handling¶
Add If tasks to handle issues:
If Task: Check if email is valid
- Valid: Continue processing
- Invalid:
- Email admin with raw email content
- Log to error queue
- Add "Invalid Lead" tag
[SCREENSHOT NEEDED: If task checking for valid email format]
Best Practices¶
✅ Do's¶
- Use dedicated email addresses: One per lead source for clarity
- Validate all parsed data: Check email format, phone format, required fields
- Handle parsing failures gracefully: Alert admin when emails can't be parsed
- Normalize data: Use formatters for phones, dates, etc.
- Add source tags: Always tag leads with their source
- Deduplicate: Check for existing contacts before creating new ones
- Test with real samples: Use actual lead emails to test parsing
- Monitor parsing accuracy: Regularly check that fields are extracted correctly
❌ Don'ts¶
- Don't mix lead emails with other emails: Use dedicated addresses
- Don't assume perfect parsing: Always validate extracted data
- Don't skip error notifications: Alert yourself when parsing fails
- Don't ignore spam: Filter out spam lead emails
- Don't forget follow-up: Always close the loop with new leads
- Don't lose attribution: Always capture and store lead source
Troubleshooting¶
Emails Not Triggering Workflow¶
Possible Causes: - Email account not connected - Email matching rules too restrictive - Workflow disabled - Emails going to spam
Solutions: 1. Verify email account connection 2. Check sender address in matching rules 3. Ensure workflow toggle is ON 4. Check spam folder in email account
Fields Not Being Parsed Correctly¶
Possible Causes: - Email format changed - Parsing pattern incorrect - Field names different than expected
Solutions: 1. Review a sample email that failed 2. Update parsing pattern to match new format 3. Check execution history for raw email content 4. Test parsing with sample emails
Duplicate Leads Created¶
Possible Causes: - Multiple email notifications for same lead - Match to Client not checking for duplicates
Solutions: 1. Add deduplication logic:
// Check if lead already processed recently
const email = results['task_52123_lead_email'];
// Query CRM for recent leads with this email
Getting Spam Lead Emails¶
Possible Causes: - Public lead email address - No spam filtering
Solutions: 1. Don't publish lead email address publicly 2. Use it only in platform configurations 3. Add If task to detect spam patterns:
const isSuspiciousEmail = /viagra|casino|lottery/i.test(email);
const isSuspiciousDomain = email.endsWith('.xyz') || email.endsWith('.tk');
Advanced Features¶
Multi-Language Lead Parsing¶
For international leads:
- Leads Mail Trigger - Parse email
- AI Prompt - Detect language and translate to English
- Continue with standard processing
Lead Attachment Processing¶
Some leads include attachments (resumes, documents):
- Leads Mail Trigger - Parse email
- If Task - Check if attachments exist
- Webhook Out - Download attachment
- PDF Task or AI Prompt - Extract data from attachment
- Merge with lead data
Lead Response Time Tracking¶
Track how quickly you respond:
- Leads Mail Trigger - Parse lead (timestamp: A)
- Match to Client - Find existing contact
- [Sales rep responds]
- [Later] MySQL Query - Log response time (timestamp: B)
- Calculate: B - A = response time
Intelligent Lead Assignment¶
Assign based on various factors:
- Leads Mail Trigger - Parse lead
- Code Task - Determine best rep based on:
- Geographic location
- Industry expertise
- Current workload
- Past performance
- Edit Client - Assign to determined rep
- Email - Notify assigned rep
Frequently Asked Questions¶
What's the difference between Leads Mail Trigger and Email Trigger?¶
Email Trigger: General email monitoring, returns full email content.
Leads Mail Trigger: Specifically designed for parsing lead data from structured emails. Automatically extracts fields.
Can I use this for other types of structured emails?¶
Yes, but Leads Mail Trigger is optimized for lead data. For other types, consider Email Trigger with parsing in Code task.
What if the email format changes?¶
Update your parsing configuration. It's good practice to: - Monitor parsing success rate - Set up alerts for parsing failures - Test new formats before going live
Can I parse multiple leads from one email?¶
If an email contains multiple leads, use a Loop task to process each one separately after parsing.
How do I handle international phone formats?¶
Use Phone Formatter task after parsing to normalize all phone numbers to a standard format (E.164 recommended).
What if required fields are missing from the email?¶
Add If task validation: - If missing: Send alert to admin, don't create lead - Or create lead with "Incomplete Data" tag for manual review
Can I automatically respond to the lead email?¶
Yes, use the sender's email address from the lead data:
How quickly are leads processed?¶
Usually within 1-2 minutes of email receipt, depending on system load.
Can I test parsing without waiting for real leads?¶
Yes, forward a sample lead email to your leads address, or use the "Run Test" feature with a sample email.
Next Steps: - Email Trigger - General email monitoring - Match to Client Task - Find/update contact records - Phone Formatter Task - Normalize phone numbers