← All N8N workflows
Business & commerceCodeHTTP RequestHubspotIfItem Lists

``Aggregate `amount_captured` ``

Configured with HTTP Request, Hubspot, Item Lists, Schedule Trigger, and additional nodes. Review the connections and setup before adapting this template.

Workflow preview
RoutingIf charge has customerIfIntegrationGet customerStripeTriggerOn scheduleSchedule TriggerTransformRemove duplicatecustomersItem ListsTransformAggregate`amount_captured`Item ListsCodeAggregate totalsCodeIntegrationCreate or updatecustomerHubspotTransformMerge dataMergeIntegrationGet all chargesStripeWeb / APIGet HubSpot fieldHTTP RequestWeb / APICreate field in HubSpotHTTP RequestTransformConfigureEdit FieldsRoutingSkip field checkingIfRoutingDo nothingNo OpRoutingIf field existsIf

Node categories in this workflow

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

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
If charge has customerRoutingIfSee node parameters
Get customerIntegrationStripecustomer
On scheduleTriggerSchedule TriggerSee node parameters
Remove duplicate customersTransformItem ListsremoveDuplicates
Aggregate `amount_captured`TransformItem ListsaggregateItems
Aggregate totalsCodeCodeSee node parameters
Create or update customerIntegrationHubspotcontact
Merge dataTransformMergeSee node parameters
Get all chargesIntegrationStripecharge / getAll
Get HubSpot fieldWeb / APIHTTP RequestSee node parameters
Create field in HubSpotWeb / APIHTTP RequestPOST
ConfigureTransformEdit FieldsSee node parameters
Skip field checkingRoutingIfSee node parameters
Do nothingRoutingNo OpSee node parameters
If field existsRoutingIfSee node parameters

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

  • hubspotOAuth2Api
  • stripeApi

Workflow notes

`Merge data`

Merge data

More specifically, we merge the Stripe data from Get charges and Get customer nodes. Only the charges with customers on them will continue.

`Aggregate totals`

Aggregate totals

Given the merged data, we now aggregate the amounts from charges to the customers/contacts.

``Aggregate `amount_captured` ``

Aggregate `amount_captured`

This does nothing. It is an alternative way to find the totals of every charge in existence in Stripe. Potentially useful for debugging purposes.

Sync Stripe charges to HubSpot contacts

Sync Stripe charges to HubSpot contacts

This workflow pushes Stripe charges to HubSpot contacts. It uses the Stripe API to get all charges and the HubSpot API to update the contacts. The workflow will create a new HubSpot property to store the total amount charged. If the property already exists, it will update the property.

How it works

  1. On a schedule, the first Stripe node gets all charges. The default schedule is once a day at midnight.
  2. Once the charges are returned, the second Stripe node gets extra customer information.
  3. Once the customer information is returned, Merge data node will merge the customer information with the charges so that the next node Aggregate totals can calculate the total amount charged per contact.
  4. Once we have the total amount charged per contact, the Create or update customer node will create a new HubSpot property to store the total amount charged. If the property already exists, it will update the property.

Workflow written by David Sha.

`Remove duplicate customers`

Remove duplicate customers

Ensures that we do not poll Stripe too many times unnecessarily. If multiple charges have the same customer, we ensure that we do not ask for the same information again.

Create HubSpot field if required

Create HubSpot field if required

These nodes create a HubSpot field if required. It makes the contact field that this workflow uses to store the Stripe information. To disable this section, in Configure node change checkFields to false.

Configuration

Configuration

By default, this does not need to be updated.

contactPropertyId (required): Only change if the specific HubSpot field ID has been taken.

contactPropertyLabelName (required): Change if you would like a different display name.

checkFields (required): Turn to false if you would like to optimise this workflow, provided this workflow has run once before with this configurable enabled. This will disable the section of this workflow which deals with creating a HubSpot field.

`Create or update customer`

Create or update customer

By default, the only field updated is "Stripe - Total Spend". The contact is identified by its email.

`Do nothing`

Do nothing

This is useful to know what Stripe charges had no customer assigned.

``Aggregate `amount_captured` ``

Aggregate `amount_captured`

Purpose and structure

This folder contains the Aggregate `amount_captured` workflow. Its executable nodes use code, httpRequest, hubspot, if, itemLists, merge, noOp, scheduleTrigger, set, stripe. 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

On schedule

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/0288_Code_Schedule_Create_Webhook.json MIT; preserve source notices.

More in Business & commerce