All projects · Automation & Data Pipelines
Merge Sources, Count Customers by Region
Fetches the full country list from the public REST Countries API, fans that data out alongside a hardcoded set of five customer records, merges…
Fetches the full country list from the public REST Countries API, fans that data out alongside a hardcoded set of five customer records, merges the two streams, builds a country-name -> region lookup, assigns each customer to a continent/region, and tallies a per-region customer count into a text summary.
- Fan-out/fan-in topology: one HTTP source feeds two parallel Code branches that reconverge at a Merge node
- Enrichment/join pattern — reduces ~250 API country objects to {country, region}, then joins customers against it via a lookup dictionary
- Post-merge Code node separates the two intermingled record types by checking for the 'customer' field
- Region tally with graceful skip of any customer whose country isn't matched
- Calls an unauthenticated public API (no key required)
Built with: n8n, Manual Trigger, HTTP Request node, REST Countries API (restcountries.com v3.1), Code node (JavaScript), Merge node