n8n

How to Sync Smartlead and HubSpot Campaign Analytics?

Bring campaign results from Smartlead together with lifecycle data from HubSpot and store it in PostgreSQL, then publish a clear summary to Google Sheets. Marketing and sales teams get up to date reports without manual exports or copy paste. Clean tables in your database power dashboards and weekly reviews.

A schedule starts each run. The flow sets the Smartlead API key, calls the Smartlead API to list all campaigns, and loops through them. For each campaign it downloads the leads export as CSV, parses it into rows, and upserts both campaign and activity data into ce_campaign and ce_campaign_activity. In parallel, it looks up campaign context, pulls HubSpot contacts with properties like lifecyclestage and open deals, and routes data into hubspot tables. A merge step aligns activity and campaign records. Selected fields are then written from Postgres to Google Sheets for easy sharing.

You need a Smartlead API key, a HubSpot OAuth connection, a PostgreSQL database with the outbound_activities schema and the ce_campaign, ce_campaign_activity, and hubspot tables, and access to a Google Sheet. Set your schedule to match your reporting rhythm and map the sheet columns. Expect faster reporting, fewer errors, and a single source of truth for outreach and pipeline movement. Great for weekly pipeline reviews, outbound campaign tracking, and leadership rollups.

What are the key features?

  • Schedule Trigger starts updates on a fixed interval
  • Set node stores the Smartlead API key for all requests
  • HTTP Request nodes pull the campaign list and export leads from Smartlead
  • Split In Batches loops through campaigns and items safely
  • Code node parses CSV text into structured records ready for loading
  • PostgreSQL upserts to ce_campaign and ce_campaign_activity with independent batching
  • HubSpot OAuth node fetches contact properties like lifecyclestage and open deals and writes to hubspot tables
  • Postgres to Google Sheets publishes curated fields for easy sharing
  • Merge node aligns campaign and activity streams for accurate analytics

What are the benefits?

  • Reduce manual data gathering from 4 hours to 10 minutes per report
  • Streamline campaign reporting by 80 percent with scheduled runs
  • Improve data accuracy by 90 percent using database upserts and field mapping
  • Connect Smartlead, HubSpot, PostgreSQL and Google Sheets in one flow
  • Handle thousands of leads per run with batch processing
  • Share a clean summary with non technical teams in Google Sheets

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with Smartlead, HubSpot, PostgreSQL and Google Sheets. See the Tools Required section above for links to create accounts with these services.
  3. In the n8n credentials manager, create a PostgreSQL credential. Enter your host, port, database, user, password and SSL settings. Then open each Postgres node and in the credential dropdown click Create new credential or select your saved one.
  4. In your database, create the outbound_activities schema and the ce_campaign, ce_campaign_activity and hubspot tables. Match the columns used in the nodes so upserts succeed.
  5. Open the Set Smartlead API Key node. Paste your Smartlead API key into the API KEY field. Create or retrieve the key from your Smartlead account settings.
  6. Open both HTTP Request nodes and confirm the api_key query parameter references {{ $json['API KEY'] }}. This ensures all Smartlead calls authenticate correctly.
  7. Double click the HubSpot node. In the credential dropdown click Create new credential, choose OAuth2, and sign in to your HubSpot account. Approve the requested scopes for contacts and deals.
  8. Double click the Google Sheets node. In the credential dropdown click Create new credential and complete the OAuth2 sign in with your Google account.
  9. In the Google Sheets node, select your spreadsheet and worksheet. Map the columns to the fields sent from Postgres so the sheet updates as expected.
  10. Open the Schedule Trigger and set the interval for hourly, daily or weekly runs based on your reporting cadence.
  11. Run the workflow once manually. Check the ce_campaign, ce_campaign_activity and hubspot tables for new rows. Confirm that Google Sheets shows the expected records.
  12. Troubleshoot common issues: if you see No CSV data provided from the Code node, verify your Smartlead campaigns have leads and the API key is valid. If HubSpot data is empty, confirm the OAuth scopes and that the node pulls the needed properties. If Postgres upserts fail, check schema names, table columns and permissions.
  13. As volume grows, tune Split In Batches sizes and verify query batching is enabled on Postgres nodes to keep runs stable.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

Google Sheets

Sign up

Free: $0 (Google Sheets API usage has no additional cost; quota limits apply)

HubSpot

Sign up

Free: $0 / mo; API access included (private app or OAuth). Limits on Free: 250,000 API calls/day and 100 requests per 10 seconds per private app.

PostgreSQL

Sign up

Free: $0 (open-source PostgreSQL License; self-hosted)

Smartlead

Sign up

Basic plan: $39 / mo, includes API access

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.