Overview
The Lead Intelligence Engine automatically saves qualified leads to a Coda table. This guide covers Coda setup, column mapping, duplicate detection, and troubleshooting.Coda Setup
Prerequisites
- A Coda account (free tier works)
- A Coda document to serve as your CRM
- A table within that document for lead storage
Step 1: Create Your CRM Table
Create a New Coda Document
- Go to coda.io
- Click “New doc”
- Name it “Lead Intelligence CRM” (or your preferred name)
Configure Columns
Add these columns (exact names matter):
| Column Name | Type | Description |
|---|---|---|
| Business URL | Text | Website URL (used for duplicate detection) |
| Business Name | Text | Extracted business name |
| Business Type | Text | What the business does |
| Primary Service | Text | Recommended primary service |
| Secondary Service | Text | Optional secondary service |
| Fit Score | Number | Score from 0-100 |
| Reasoning | Text | AI’s reasoning for the recommendation |
| Outreach Angle | Text | Suggested outreach strategy |
Step 2: Get Your Coda API Token
Navigate to Account Settings
Go to coda.io/account
Generate API Token
- Scroll to API Settings
- Click Generate API token
- Give it a name like “Lead Engine”
- Copy the token (you won’t see it again)
Step 3: Get Your Document ID
Step 4: Get Your Table ID
- Method 1: Copy Link
- Method 2: API Explorer
- Right-click on your table
- Select “Copy table link”
- Paste the URL somewhere:
- The Table ID is after
#_table_:grid-abc123xyz - Add to
.env:
Verification
Your.env should now have:
.env
Column Mapping
The engine maps evaluation results to Coda columns as follows:Automatic Mapping
Column Name Requirements
Correct:Missing Columns
If a column doesn’t exist in your table, the engine skips it with a warning:Custom Column Order
Column order doesn’t matter. The engine matches by name, not position:Additional Columns
You can add extra columns for manual tracking:- Status (Select): “New”, “Contacted”, “Converted”, “Rejected”
- Assigned To (Person): Sales team member
- Follow-up Date (Date): When to reach out
- Notes (Text): Manual observations
- Created (Date): Use Coda’s formula
=thisRow.CreatedDate()
Duplicate Detection Logic
The engine prevents duplicate entries using the Business URL field.How It Works
Key Behaviors
URL Normalization
URL Normalization
The engine performs exact string matching without normalization. These are treated as different:
https://example.comhttps://www.example.comhttp://example.comhttps://example.com/
Case Sensitivity
Case Sensitivity
URLs are case-sensitive:
https://Example.com≠https://example.com
Query Limitations
Query Limitations
If the Coda API query fails (network error, auth issue), the engine:
- Logs a warning:
Duplicate check failed (Coda API): <error> - Assumes no duplicate exists (fail-safe to prevent data loss)
- Proceeds with insertion
Multiple Tables
Multiple Tables
Duplicate detection only checks the configured
CODA_TABLE_ID. If you use multiple tables, each operates independently.Preventing False Duplicates
If you’re getting “duplicate” warnings for new URLs:- Check for trailing slashes:
https://example.com/vshttps://example.com - Verify protocol consistency:
http://vshttps:// - Check for URL redirects (e.g.,
example.com→www.example.com)
Forcing Re-analysis
To re-analyze a URL already in Coda:- Delete the row in Coda
- Run the analysis again
- Temporarily change the URL in Coda to something else
- Run the analysis (will insert new row)
- Delete the old row
Data Type Handling
The engine sanitizes data before sending to Coda:Null Values
null values, so the engine converts them to empty strings.
Special Characters
No escaping needed. The engine handles:- Quotes:
Business name: "Joe's Plumbing" - Newlines: Multi-line reasoning text
- Emojis:
🚀 Awesome Business - Unicode:
Café François
Number Fields
TheFit Score column should be type Number in Coda:
Error Handling
Common Coda Errors
”Coda configuration is incomplete in .env”
Cause: Missing one or more Coda variables Fix: Verify all three variables exist in.env:
“401 Unauthorized”
Cause: Invalid or expired API token Fix:- Go to coda.io/account
- Regenerate API token
- Update
.envwith new token
”404 Not Found”
Cause: Incorrect Doc ID or Table ID Fix:- Verify Doc ID by checking document URL
- Verify Table ID using “Copy table link” method
- Ensure no extra spaces in
.env
”403 Forbidden”
Cause: API token lacks write permissions Fix:- Regenerate token with full permissions
- Ensure you own the document (not just a viewer/commenter)
“Column ‘X’ not found”
Cause: Column name mismatch (case-sensitive) Fix:- Check exact column names in Coda
- Rename to match required names:
Business URL(notBusiness urlorURL)Business Name(notNameorCompany)- etc.
Network Issues
Timeout Errors
- Check internet connection
- Verify Coda status at status.coda.io
- Increase timeout in
coda_client.py:111:
Rate Limiting
- Free tier: ~10 requests/second
- Team/Enterprise: Higher limits
- Add delays between batch operations
- Reduce parallel analysis (if running multiple bots)
- Upgrade Coda plan for higher limits
Troubleshooting
Testing Coda Connection
Run the built-in test:coda_client.py:
coda_client.py
Viewing API Logs
Enable detailed logging:coda_client.py temporarily for verbose output.
Inspecting API Responses
Modifycoda_client.py:111 to print raw responses:
Common Column Mapping Issues
Column names with extra spaces
Column names with extra spaces
Column type mismatch
Column type mismatch
If Fix: Change column type to Number in Coda
Fit Score is set as Text instead of Number, you’ll get:Required columns in Coda
Required columns in Coda
If you set Coda columns as “Required” but the engine sends empty values:Fix: Make the column optional in Coda, or ensure the AI always provides a value
Advanced Configuration
Custom Column Mapping
If you want different column names, editcoda_client.py:78-87:
coda_client.py
Multiple CRM Tables
To write to different tables based on conditions:.env.
Webhook Notifications
Use Coda automations to trigger webhooks when new rows are added:- In Coda, click Automations (top right)
- Create rule: “When rows are added to Leads”
- Action: “Send webhook” → Zapier, Make.com, or custom endpoint
- Slack notifications for new leads
- Auto-adding to other CRMs (HubSpot, Salesforce)
- Triggering email campaigns
Next Steps
CLI Usage
Start analyzing leads via command line
Telegram Bot
Use the bot interface for easier lead generation