06 · Intermediate

IF Priority Router

Routes urgent leads to Slack and queues everything else in Sheets for follow-up.

Webhook

IF

Slack

Sheets

n8n canvas preview

IF Priority Router

Download JSONOpen n8n.io ↗
Loading n8n canvas…

Canvas via n8n-demo · import JSON into n8n.io → Workflows → Import from File

Writeup

How IF Priority Router works

POST /priority → IF $json.body.priority equals “urgent” → Slack #alerts, else Google Sheets append queue.

Step by step — how to build it

  1. 01

    Add Webhook

    POST, Path priority, Respond When Last Node Finishes.

  2. 02

    Add IF

    Connect Webhook → IF. Condition: String → {{$json.body.priority}} equals urgent (strict, case-sensitive).

  3. 03

    True branch → Slack

    From IF true output → Slack → channel alerts → text :rotating_light: Urgent inbound. Attach Slack credential.

  4. 04

    False branch → Sheets

    From IF false output → Google Sheets → Append → autoMapInputData. Attach Google credential + pick spreadsheet.

  5. 05

    Prepare #alerts and the Sheet

    Invite the bot to #alerts. Sheet headers should match fields you POST (priority, email, …).

  6. 06

    Test both branches

    POST {"priority":"urgent"} → Slack only. POST {"priority":"normal"} → Sheets row only.

How it functions

1 · Webhook

POST path priority, responseMode lastNode.

2 · IF Urgent?

Strict string equals: {{$json.body.priority}} === "urgent" (case-sensitive).

3a · Slack Urgent (true)

Channel alerts, text “:rotating_light: Urgent inbound”.

3b · Sheets Queue (false)

Google Sheets append with autoMapInputData — non-urgent rows land in the sheet.

Setup notes

Import + credentials

Import JSON. Attach Slack + Google Sheets. Create #alerts and a queue spreadsheet.

Match the payload

Caller must send JSON with body.priority (n8n webhook wraps POST JSON under body).

Map the Sheet

Sheets Queue → pick Document + Sheet; autoMap works once headers exist, or set columns manually.

Tips

priority must be exactly urgent — lowercase; normalize upstream if clients send Urgent.

True branch does not append Sheets; false does not Slack — by design in this export.

Import into n8n.io → Workflows → Import from File, attach credentials, activate.

← Form to GmailWebhook Sheets Log →
© 2026 thenionic · IF Priority Router