Overview
This guide shows you how to integrate SpiderIQ’s orchestrated campaigns with n8n, the powerful workflow automation platform. You’ll build a complete visual workflow that:- Creates orchestrated campaigns via SpiderIQ API
- Loops through locations until complete
- Fetches aggregated results
- Exports to Google Sheets, Airtable, or your database
Prerequisites
n8n Instance
Self-hosted or n8n Cloud account
SpiderIQ Credentials
Your API token from SpiderIQ dashboard
Step 1: Create SpiderIQ Credentials
First, set up authentication for SpiderIQ in n8n.1
Open Credentials
In n8n, go to Settings → Credentials → Add Credential
2
Select Type
Choose Header Auth (since SpiderIQ uses Bearer token)
3
Configure
- Name:
SpiderIQ API - Header Name:
Authorization - Header Value:
Bearer cli_xxx:sk_xxx:secret_xxx(your full token)
4
Save
Click Save to store the credential securely
Step 2: Create Campaign Node
Set up the HTTP Request node to create an orchestrated campaign.HTTP Request Node Configuration
General Settings:| Setting | Value |
|---|---|
| Method | POST |
| URL | https://spideriq.di-atomic.com/api/v1/jobs/spiderMaps/campaigns/submit |
| Authentication | Predefined Credential Type → Header Auth |
| Credential | SpiderIQ API |
| Header | Value |
|---|---|
| Content-Type | application/json |
Response
The node outputs:Step 3: Loop Until Complete
Create a loop that calls/next until all locations are processed.
Loop Structure
HTTP Request Node: Call /next
Configuration:| Setting | Value |
|---|---|
| Method | POST |
| URL | https://spideriq.di-atomic.com/api/v1/jobs/spiderMaps/campaigns/{{ $json.campaign_id }}/next |
| Authentication | Header Auth → SpiderIQ API |
IF Node: Check has_more
Condition:- Value 1:
{{ $json.has_more }} - Operation:
equal - Value 2:
true
- True: Continue to Wait node, then loop back
- False: Exit loop, proceed to get results
Wait Node
Configuration:- Wait Time:
2seconds - Reason: Rate limiting and allowing jobs to process
Step 4: Get Workflow Results
After the loop completes, fetch aggregated results.HTTP Request Node: Get Results
Configuration:| Setting | Value |
|---|---|
| Method | GET |
| URL | https://spideriq.di-atomic.com/api/v1/jobs/spiderMaps/campaigns/{{ $json.campaign_id }}/workflow-results |
| Authentication | Header Auth → SpiderIQ API |
Step 5: Transform and Flatten Data
Use a Code node or Item Lists node to flatten the nested results.Code Node: Flatten Results
JavaScript:Step 6: Export to Destination
Connect the flattened data to your preferred destination.Option A: Google Sheets
Google Sheets Node Configuration:| Setting | Value |
|---|---|
| Operation | Append or Update |
| Document | Your Google Sheet |
| Sheet | Leads |
| Mapping | Define each column |
| Column | Value |
|---|---|
| A - Business Name | {{ $json.business_name }} |
| B - Phone | {{ $json.business_phone }} |
| C - Address | {{ $json.business_address }} |
| D - Rating | {{ $json.business_rating }} |
| E - Domain | {{ $json.domain }} |
| F - Email | {{ $json.email }} |
| G - Lead Score | {{ $json.lead_score }} |
| H - Location | {{ $json.location }} |
| I - Campaign ID | {{ $json.campaign_id }} |
Option B: Airtable
Airtable Node Configuration:| Setting | Value |
|---|---|
| Operation | Create |
| Base | Your Airtable Base |
| Table | Leads |
Option C: PostgreSQL / MySQL
Database Node Configuration:| Setting | Value |
|---|---|
| Operation | Insert |
| Table | leads |
Step 7: Schedule the Workflow
Set up automated execution with the Schedule Trigger node.Schedule Trigger Configuration
Example Schedules:| Schedule | Cron Expression | Description |
|---|---|---|
| Daily at 8 AM | 0 8 * * * | Run every morning |
| Weekly Monday | 0 9 * * 1 | Weekly on Monday at 9 AM |
| Every 6 hours | 0 */6 * * * | Four times per day |
Manual Trigger for Testing
Add a Manual Trigger node in parallel for testing:Set Parameters Node
Configure campaign parameters:Complete Workflow
Here’s the full workflow structure:Importable Workflow JSON
Copy this JSON and import it into n8n:Complete Workflow JSON
Complete Workflow JSON
After importing, you’ll need to:
- Create the SpiderIQ API credential
- Complete the Loop and remaining nodes
- Configure your destination (Sheets/Airtable/DB)
Error Handling
Add error handling with the Error Trigger workflow.Error Trigger Workflow
Create a separate workflow that triggers on errors:Retry Logic
Wrap API calls in a Loop with retry logic:Best Practices
Use Sub-Workflows
Break complex logic into sub-workflows for maintainability.
Add Logging
Use the Notion or Airtable node to log each run for debugging.
Set Timeouts
Configure execution timeouts for long campaigns.
Monitor Executions
Check n8n’s Execution History for failed runs.
Troubleshooting
401 Unauthorized Error
401 Unauthorized Error
Loop Never Exits
Loop Never Exits
- Check the IF node condition:
{{ $json.has_more }} == true - Verify the
/nextresponse includeshas_morefield - Add a maximum iterations safety limit
Empty Results
Empty Results
- Confirm the campaign completed (check
/status) - Verify
has_workflow: truein campaign response - Check if locations had any businesses
Timeout Errors
Timeout Errors
- Increase workflow timeout in Settings
- For large campaigns, consider splitting by region
- Add longer Wait times between
/nextcalls
