Overview
This guide shows you how to integrate SpiderIQ’s orchestrated campaigns with Xano, a no-code backend platform. You’ll build a complete lead generation system that:- Creates orchestrated campaigns via SpiderIQ API
- Processes locations automatically with workflow chaining
- Stores enriched leads in your Xano database
- Schedules recurring campaigns with Xano Tasks
Prerequisites
Xano Account
Free tier works for testing. Pro tier recommended for production.
SpiderIQ Credentials
Your API token from SpiderIQ dashboard.
Step 1: Store API Credentials
First, securely store your SpiderIQ API token in Xano’s environment variables.1
Open Xano Settings
Navigate to your Xano workspace → Settings → Environment Variables
2
Add SpiderIQ Token
Create a new variable:
- Name:
SPIDERIQ_TOKEN - Value: Your SpiderIQ API token (e.g.,
cli_xxx:sk_xxx:secret_xxx) - Environment: Production (and optionally Development)
3
Save Changes
Click Save. This token is now accessible in all Function Stacks.
Step 2: Create Database Tables
Create three tables to store campaign data and leads.Table: campaigns
| Field | Type | Description |
|---|---|---|
id | Integer (Auto) | Primary key |
campaign_id | Text | SpiderIQ campaign ID |
query | Text | Search query (e.g., “restaurants”) |
country_code | Text | ISO country code |
status | Text | Campaign status |
total_locations | Integer | Number of locations |
has_workflow | Boolean | Workflow enabled |
created_at | Timestamp | Creation time |
completed_at | Timestamp | Completion time |
Table: leads
| Field | Type | Description |
|---|---|---|
id | Integer (Auto) | Primary key |
campaign_id | Text | Foreign key to campaigns |
business_name | Text | Business name |
business_address | Text | Full address |
business_phone | Text | Phone number |
business_rating | Decimal | Google rating |
domain | Text | Website domain |
location | Text | City/location name |
workflow_stage | Text | Current stage |
created_at | Timestamp | Creation time |
Table: lead_emails
| Field | Type | Description |
|---|---|---|
id | Integer (Auto) | Primary key |
lead_id | Integer | Foreign key to leads |
email | Text | Email address |
status | Text | valid, invalid, risky, unknown |
score | Integer | Deliverability score (0-100) |
is_deliverable | Boolean | Is deliverable |
is_role_account | Boolean | Is role account (info@, etc.) |
Step 3: Create Campaign Function Stack
Build a Function Stack to create orchestrated campaigns.Function Stack: create_campaign
Input Parameters:
query(Text, required) - Search querycountry_code(Text, required) - ISO country codemin_population(Integer, optional) - Minimum city population
Step-by-Step Configuration
Step-by-Step Configuration
Node 1: Build Request BodyNode 2: HTTP Request
- Type: Create Variable
- Name:
request_body - Value (Object):
- Type: External API Request
- Method: POST
- URL:
https://spideriq.di-atomic.com/api/v1/jobs/spiderMaps/campaigns/submit - Headers:
Authorization:Bearer $env.SPIDERIQ_TOKENContent-Type:application/json
- Body:
$var.request_body
- Type: Add Record (campaigns table)
- Fields:
campaign_id:$external.campaign_idquery:$input.querycountry_code:$input.country_codestatus:$external.statustotal_locations:$external.total_locationshas_workflow:$external.has_workflowcreated_at:now()
- Type: Return
- Value:
$external(full SpiderIQ response)
Example Response
Step 4: Process Campaign Loop
Create a Function Stack that processes all locations in a campaign.Function Stack: process_campaign
Input Parameters:
campaign_id(Text, required) - The SpiderIQ campaign ID
Step-by-Step Configuration
Step-by-Step Configuration
Node 1: Initialize Loop Variable
- Type: Create Variable
- Name:
has_more - Value:
true
- Type: Loop (While)
- Condition:
$var.has_more == true
- Type: External API Request
- Method: POST
- URL:
https://spideriq.di-atomic.com/api/v1/jobs/spiderMaps/campaigns/$input.campaign_id/next - Headers:
Authorization:Bearer $env.SPIDERIQ_TOKEN
- Type: Update Variable
- Name:
has_more - Value:
$external.has_more
- Type: Conditional
- Condition:
$external.current_task != null
- Type: Create Variable
- Name:
progress_log - Value:
Processing: $external.current_task.search_string
- Type: Utilities → Wait
- Duration: 2 seconds
- Type: Edit Record (campaigns table)
- Filter:
campaign_id == $input.campaign_id - Fields:
status:completedcompleted_at:now()
- Type: Return
- Value:
{ "status": "completed", "campaign_id": "$input.campaign_id" }
Step 5: Get and Store Results
After the campaign completes, fetch and store the aggregated results.Function Stack: get_campaign_results
Input Parameters:
campaign_id(Text, required) - The SpiderIQ campaign ID
Step-by-Step Configuration
Step-by-Step Configuration
Node 1: Fetch Workflow Results
- Type: External API Request
- Method: GET
- URL:
https://spideriq.di-atomic.com/api/v1/jobs/spiderMaps/campaigns/$input.campaign_id/workflow-results - Headers:
Authorization:Bearer $env.SPIDERIQ_TOKEN
- Type: Loop (For Each)
- Array:
$external.locations - Item Variable:
location
- Type: Loop (For Each)
- Array:
$var.location.businesses - Item Variable:
business
- Type: Add Record (leads table)
- Fields:
campaign_id:$input.campaign_idbusiness_name:$var.business.business_namebusiness_address:$var.business.business_addressbusiness_phone:$var.business.business_phonebusiness_rating:$var.business.business_ratingdomain:$var.business.domainlocation:$var.location.display_nameworkflow_stage:$var.business.workflow_stagecreated_at:now()
- Type: Create Variable
- Name:
lead_id - Value:
$addrecord.id
- Type: Loop (For Each)
- Array:
$var.business.emails_verified - Item Variable:
email - Condition:
$var.email.status == "valid"
- Type: Add Record (lead_emails table)
- Fields:
lead_id:$var.lead_idemail:$var.email.emailstatus:$var.email.statusscore:$var.email.scoreis_deliverable:$var.email.is_deliverableis_role_account:$var.email.is_role_account
- Type: Return
- Value:
Step 6: Schedule with Xano Tasks
Automate your lead generation with scheduled tasks.Create a Scheduled Task
1
Navigate to Tasks
Go to your Xano workspace → Background Tasks
2
Create New Task
Click “Add Task” and configure:
- Name:
daily_lead_campaign - Schedule: Cron expression (e.g.,
0 8 * * *for 8 AM daily)
3
Configure Task Logic
Build a Function Stack that:
- Creates a new campaign with today’s parameters
- Calls
process_campaignto iterate locations - Calls
get_campaign_resultsto store leads - Optionally sends notification (email, Slack webhook)
Complete Scheduled Task Function Stack
Step 7: Build a Dashboard API
Create endpoints for your frontend to display campaign progress.Endpoint: GET /campaigns
Returns all campaigns with progress stats.
Endpoint: GET /campaigns/{id}/leads
Returns leads for a specific campaign with filtering.
Query Parameters:
min_rating- Filter by minimum Google ratinghas_email- Only leads with valid emailspage,page_size- Pagination
Complete Xano Workflow
Here’s the complete automated flow:Error Handling
Add error handling to your Function Stacks:API Error Handling
API Error Handling
After each External API Request, add a Conditional:
Retry Logic
Retry Logic
For transient failures, implement retry:
Best Practices
Batch Processing
For large countries, split into regional campaigns to avoid timeouts.
Rate Limiting
Add 1-2 second delays between API calls. SpiderIQ queues jobs asynchronously.
Incremental Storage
Store leads as they come in via
/next responses, not just at the end.Monitoring
Log campaign progress and set up alerts for failures.
