← All N8N workflows
Data & databasesCodeGoogle SheetsHTTP RequestHubspotIf

HUBSPOT LIFECYCLESTAGE (LEAD STATUS)

Configured with Google Sheets, HTTP Request, Hubspot, Postgres, and additional nodes. Review the connections and setup before adapting this template.

Workflow preview
Web / APIEXTRACT CAMPAIGN DATAHTTP RequestWeb / APIFETCH ALL CAMPAIGNSHTTP RequestRoutingLoop Over ItemsLoop Over ItemsData storeUPDATE CAMPAIGNPostgresTransformMergeMergeCodeCodeCodeRoutingLoop Over Items1Loop Over ItemsIntegrationHubSpotHubspotRoutingIfIfTriggerSchedule TriggerSchedule TriggerData storeUPSERT CAMPAIGNACTIVITYPostgresData storeHUBSPOT TABLEPostgresData storeSEARCHPostgresData storePostgres1PostgresData storeUPDATE HUBSPOT ACTIVITYTABLEPostgresTransformSET SMARTLEAD API KEYEdit FieldsData storePostgresPostgresData storeGoogle SheetsGoogle Sheets

Node categories in this workflow

  • Web / API
  • Routing
  • Data store
  • Transform
  • Code
  • Integration
  • Trigger

Icons describe general node roles, inferred from node types. Inspect the parameters for the configured action.

Drag to pan; use + and − to zoom. Reconstructed from the exported node positions; nothing runs here. Dashed lines represent non-main connections. Full node names and notes appear below.

How it works

The exported workflow contains the following configured nodes. Their connections are shown above; inspect the JSON for the complete logic, expressions, and external actions.

Workflow node names, types, and operations
NodeCategoryTypeOperation
EXTRACT CAMPAIGN DATAWeb / APIHTTP RequestSee node parameters
FETCH ALL CAMPAIGNSWeb / APIHTTP RequestSee node parameters
Loop Over ItemsRoutingLoop Over ItemsSee node parameters
UPDATE CAMPAIGNData storePostgresupsert
MergeTransformMergeSee node parameters
CodeCodeCodeSee node parameters
Loop Over Items1RoutingLoop Over ItemsSee node parameters
HubSpotIntegrationHubspotgetAll
IfRoutingIfSee node parameters
Schedule TriggerTriggerSchedule TriggerSee node parameters
UPSERT CAMPAIGN ACTIVITYData storePostgresupsert
HUBSPOT TABLEData storePostgresupsert
SEARCHData storePostgresexecuteQuery
Postgres1Data storePostgresupdate
UPDATE HUBSPOT ACTIVITY TABLEData storePostgresupdate
SET SMARTLEAD API KEYTransformEdit FieldsSee node parameters
PostgresData storePostgresexecuteQuery
Google SheetsData storeGoogle SheetsappendOrUpdate

Setup

  1. Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
  2. Connect your own credentials through n8n’s credential store. Replace REPLACE_WITH_* values with your resource identifiers.
  3. Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
  4. Run with synthetic data and harmless destinations. Enable triggers only after checking the actual outputs.

Requirements

An n8n instance with the listed node types and compatible versions. Service-connected workflows may require accounts, credentials, or paid APIs.

Credential types declared in the source

  • googleSheetsOAuth2Api
  • hubspotOAuth2Api
  • postgres

Workflow notes

Code

// Retrieve the CSV-like data from the 'data' field in the input const csvData = $json['data']; // Ensure that 'data' is the correct field name

// Check if csvData exists and is not empty if (!csvData) { console.log("Input data structure:", $json); // Debugging output to inspect input structure throw new Error('No CSV data provided. Ensure the correct field reference is being used.'); }

// Split the CSV into rows const rows = csvData.split('\n');

// Extract the headers const headers = rows[0].replace(/"/g, '').split(',');

// Iterate over each data row and map it to an object const output = rows.slice(1).map(row => { const values = row.match(/(".?"|[^",]+)(?=\s,|\s*$)/g).map(value => { // Remove surrounding quotes from each value if present return value.startsWith('"') && value.endsWith('"') ? value.slice(1, -1) : value; });

const item = {}; headers.forEach((header, index) => { item[header] = values[index] || null; });

return { json: item }; });

return output;

Campaign Analytics Report Documentation

Campaign Analytics Report Documentation

Overview

This report provides a high-level summary of campaign performance, designed to help stakeholders quickly assess the outcomes of marketing or sales campaigns. It includes data on campaign activity, targeted audiences, and progression metrics, allowing for a holistic view of campaign effectiveness.

Key Metrics

1	**Campaign Identification and Status**

    •	Campaign ID: A unique identifier assigned to each campaign for tracking purposes.
•	Status: Indicates the current state of the campaign:
•	Active: Campaign is ongoing.
•	Paused: Campaign is temporarily on hold.
•	Archived: Campaign has concluded.

2 Targeting and Reach

•	Total Companies: Number of companies targeted within the campaign scope.

3 Pipeline Metrics

•	Lead Count: Total number of leads generated by the campaign.
•	Marketing Qualified Leads (MQLs): Leads that meet predefined marketing qualification criteria.
•	Sales Qualified Leads (SQLs): Leads that are validated as sales-ready by the team.
•	Opportunities: Potential deals created from campaign engagement.
•	Customers: Number of deals successfully closed, converting leads into customers.

4 Lifecycle Stages

•	Lifecycle Stage Metrics: Counts of entities (e.g., leads, opportunities, or customers) at specific lifecycle stages. These stages represent the journey from lead generation to conversion.

How to Use This Report

•	**Evaluate Campaign Success**: Compare metrics like total companies, leads, and customers to understand campaign impact.
•	**Understand Pipeline Health**: Analyze how many entities progress through the funnel (e.g., from MQL to SQL to Opportunity).
•	**Monitor Campaign Status**: Use the status column to focus on active campaigns or review the outcomes of archived ones.
•	**Assess Engagement**: Check opportunity and customer counts to gauge how effective the campaign is in driving conversions.
HUBSPOT LIFECYCLESTAGE (LEAD STATUS)

HUBSPOT LIFECYCLESTAGE (LEAD STATUS)

Purpose and structure

This folder contains the HUBSPOT LIFECYCLESTAGE (LEAD STATUS) workflow. Its executable nodes use code, googleSheets, httpRequest, hubspot, if, merge, postgres, scheduleTrigger, set, splitInBatches. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.

Setup

Import inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.

Entry points

Schedule Trigger

Verification

Sanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.

Attribution

https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Code/0655_Code_Postgres_Update_Scheduled.json MIT; preserve source notices.

Canvas section labels

These name areas of the original canvas; they do not include explanatory instructions.

  • HUBSPOT LIFECYCLESTAGE (LEAD STATUS)
  • SMARTLEAD CAMPAIGN DATA
  • Search for your smartlead API key [here](https://app.smartlead.ai/app/settings/profile)
  • POSTGRES INSTALATION [Guide](https://github.com/wukimidaire/postgres_table_templates)

More in Data & databases