What This Automation Does
This workflow sorts customer data automatically.
It fixes the problem of spending many hours sorting records by country.
When started, it gets all customers, then sends them to different paths based on country and name rules.
The result is that customers get the right messages without errors.
Inputs, Processing, and Outputs
Inputs
- The workflow starts by fetching all customer records from a customer data source in n8n.
Processing Steps
- Use If nodes to check if a customer’s country is “US” or if the country is empty or the name contains a keyword like “Max”.
- Combine conditions with OR or AND by setting combination rules inside If nodes.
- Send customer data through a Switch node to sort customers from US, CO, UK, or others into different workflow paths.
- Add Sticky Note nodes to explain each step for easier understanding.
Outputs
- The customer data streams branch out to correct handling steps based on filtered countries or names.
- No customer data is lost due to the fallback route for unmatched countries.
Who Should Use This Workflow
This workflow is good for people who manage customer data but do not want hard coding or many manual steps.
Anyone who needs to send messages by region or want no mistakes when sorting records will benefit.
Tools and Services Used
- n8n: The automation tool where this workflow runs.
- Customer Datastore node: Fetches all customer data.
- If nodes: Filter customers by country or name conditions.
- Switch node: Routes customer data by selected countries.
- Sticky Note nodes: Add explanations inside the workflow.
Beginner Step-by-Step: How to Use This Workflow in Production
Import the Workflow
- Download this workflow using the Download button on this page.
- Open your n8n editor.
- Click on “Import from File” and select the downloaded workflow file.
Configure the Workflow
- Add your credentials or API Keys for the Customer Datastore node.
- Change any IDs, emails, channels, folders, or tables as needed to fit your data.
- Check the expressions inside If and Switch nodes to match your data fields, for example:
{{$json["country"]}
Test and Activate
- Run the workflow manually once using the Manual Trigger node’s “Execute Workflow” button.
- Verify customer data flows correctly through the branches.
- When satisfied, activate the workflow by toggling the Active switch in n8n.
Optionally, add a Cron node to schedule regular runs.
For more control, consider running n8n on your own server with self-host n8n.
Customizations
- Adjust the countries in the Switch node to match your own region codes.
- Change the text keyword in the If node to filter other names instead of “Max”.
- Switch combination logic in If nodes between OR (
any) or AND (all) to control filtering details. - Add new routing rules in the Switch node for more countries or different conditions.
- Edit or add new Sticky Note nodes to keep workflow documentation up to date for your team.
Troubleshooting
Workflow returns no data after filtering
The filter conditions might not match any records.
Double-check JSON expressions used in the If nodes, like {{$json["country"]}}.
Run the workflow step-by-step and inspect outputs.
Switch node does not route data as expected
Country codes may be misspelled or case does not match exactly.
Verify spelling and capitalization in route rules.
Make sure fallback route is set to catch missing matches.
Pre-Production Checklist
- Check the Customer Datastore node can fetch data properly.
- Test all If node filters with actual sample data.
- Ensure the Switch node covers all expected countries and includes fallback output.
- Run manual tests with different datasets to confirm data flows on all branches.
- Backup the workflow file before deploying to production.
Deployment Guide
- Activate workflow by toggling the Active button inside n8n.
- Schedule runs with a Cron node for automation.
- Watch execution logs inside the n8n dashboard for errors or issues.
- Set alerts or logs if customer data does not filter correctly.
Summary and Results
✓ Save hours each week by stopping manual sorting.
✓ Reduce errors in customer targeting by filtering automatically.
✓ Handle multiple routing paths inside a clear, easy workflow.
✓ Visual notes make understanding and maintenance simpler.
→ Customer messages better match their region and interests.
→ Users with little coding skill can change filters and routes easily.
