Route Form Submissions by Company Type

Difficulty
4/10
Tags
SwitchForm TriggerSplit OutGoogle SheetsSlackConditional Routing
Requirements
Google Sheets ApiSlack Api

Your startup receives inbound leads from a web form. Each submission includes a company_type field that can be: ideal_customer, high_value, low_value, or none.

Not every submission deserves the same treatment — high-value prospects need immediate attention, while low-value leads can be nurtured automatically.

What you'll practice:

  • Switch node for multi-path routing
  • Google Sheets integration
  • Slack notifications
  • Handling "no match" cases

Your Task

  1. 1Copy the exercise below
  2. 2Paste into your n8n editor (Ctrl+V)
  3. 3Solve it — use hints if you get stuck
  4. 4Check the solution when done

Route each submission to the appropriate destination based on company type:

Company TypeAction
ideal_customerSend Slack message to alert sales team
high_valueAdd row to "High Value Leads" Google Sheet
low_valueAdd row to "Nurture List" Google Sheet
noneDo nothing

Fetch the submissions from: https://gist.githubusercontent.com/paulkunhardt/09d50eb23556933e70d6be87f6913fc7/raw/3c969363367439c0c0294c71eb1f052b72dec3b2/gistfile1.txt

Expected results for the test data:

  • 2 Slack messages (Anna Schmidt, Sarah Jones)
  • 1 row in "High Value Leads" (Tom Wilson)
  • 1 row in "Nurture List" (Lisa Chen)
  • 0 actions for Max Müller

Hints

  1. Use an HTTP Request node to fetch the form submissions
  2. Add a Switch node to route based on the company_type field
  3. Connect each output to the appropriate destination node

Setup required:

  • Google Sheets: Create a sheet with two tabs ("High Value Leads" and "Nurture List") with headers: ID, Name, Email, Company, Message, Submitted At
  • Slack: Connect your workspace and choose a channel

Constraints:

  • Use a Switch node (not multiple IF nodes)
  • Slack messages should include name, company, and message
  • Google Sheets rows should include all relevant fields
  • none submissions should trigger no action

Alternatives: No Google Sheets? Use Notion/Airtable. No Slack? Use Discord/Email.

Explanation

Why this solution works:

You have multiple leads that need to go to different destinations based on their company_type value. Instead of building separate workflows or using complex IF/ELSE chains, the Switch node lets you define all routing rules in one place and creates multiple output paths.

How it solves the problem:

  1. HTTP Request fetches all the leads at once. The API returns an array of submissions wrapped in a data field. Each submission has fields like name, email, company, and company_type.
  2. Edit Fields extracts the array. The response comes as { "data": [...] }, so we use Edit Fields to pull out just the data array for processing.
  3. Split Out turns the array into individual items. This is critical: without Split Out, the Switch node would only run once for the entire array. With Split Out, each lead becomes a separate item that flows through the workflow independently. This means 5 leads = 5 separate executions through the Switch node.
  4. Switch node routes each lead to the right destination. The Switch evaluates $json.company_type against four conditions:
    • If it equals ideal_customer, the lead goes out Output 1 (to Slack)
    • If it equals high_value, the lead goes out Output 2 (to High Value Leads sheet)
    • If it equals low_value, the lead goes out Output 3 (to Nurture List sheet)
    • If it equals none, the lead goes out Output 4 (which has no connection, so nothing happens)
  5. Each destination node only receives matching leads. The Slack node only sees ideal customers. The Google Sheets nodes only see their respective lead types. This happens automatically because the Switch physically separates the data flow.

Why Switch instead of multiple IF nodes: A Switch node is cleaner when you have more than two outcomes. With IF nodes, you would need to chain them together (IF ideal_customer, ELSE IF high_value, ELSE IF...), which gets messy. The Switch shows all your routing rules in one place and creates parallel paths that are easier to visualize and maintain.

Copy the Solution

Paste into n8n with Ctrl+V to compare with your approach.

Login to see the exercise

Create an account to access challenges and track your progress.

Log in to see exercise

Related Content

Continue your learning journey with these related challenges and guides: