n8n Tutorial: Build a Deal Rotation System in Pipedrive

If your sales team is manually assigning new Pipedrive deals to reps, you're losing time and introducing bias. A deal rotation system ensures every lead gets distributed fairly and instantly — no spre

n8n Tutorial: Build a Deal Rotation System in Pipedrive

If your sales team is manually assigning new Pipedrive deals to reps, you're losing time and introducing bias. A deal rotation system ensures every lead gets distributed fairly and instantly — no spreadsheets, no arguments, no forgotten leads. With n8n, you can build this in under an hour and never think about it again.

What Deal Rotation Actually Solves

Most teams start with informal assignment rules: "whoever is free gets the next lead." That breaks down at scale. Reps miss notifications, managers play favorites unintentionally, and there's no audit trail when a lead falls through the cracks.

A proper rotation system does three things:

  • Assigns new deals to the next rep in queue, automatically
  • Tracks who received the last assignment so the cycle stays fair
  • Notifies the assigned rep immediately so response time stays low

n8n handles all three without requiring a backend developer or a paid add-on inside Pipedrive.

How the Workflow Is Structured

The workflow triggers whenever a new deal is created in Pipedrive. From there, it reads a rotation counter stored in a simple data source — a Google Sheet works fine — increments it, picks the next rep from your list, updates the deal owner in Pipedrive, and sends a Slack or WhatsApp notification to that rep.

The core nodes you'll need:

  • Pipedrive Trigger — listens for the "deal created" event via webhook
  • Google Sheets Read — pulls the current rotation index and rep list
  • Function node — calculates the next rep using modulo arithmetic (index % reps.length)
  • Google Sheets Update — saves the incremented index back to the sheet
  • Pipedrive Update Deal — sets the owner_id to the selected rep
  • Slack or WhatsApp node — notifies the rep with deal name, company, and a direct link

The logic is intentionally simple. The rotation counter is just a number. Every time a deal comes in, you move one position forward in the array. When you hit the last rep, you wrap back to the first. No database required.

Building the Rotation Logic in n8n

Inside the Function node, the rotation calculation looks like this:

  • Pull currentIndex from your Google Sheet (it starts at 0)
  • Define your rep array: ["user_id_1", "user_id_2", "user_id_3"]
  • Calculate selected rep: reps[currentIndex % reps.length]
  • Increment: currentIndex + 1 and write it back to the sheet

One thing to handle carefully: concurrent deals. If two deals come in within milliseconds, both Function nodes might read the same index before either has written back the increment. For low-volume teams this rarely matters. For high-volume pipelines, replace the Google Sheet with a locked counter in Redis or use n8n's built-in execution queue to serialize requests.

Also worth setting up: a skip condition. If a rep is on vacation, you want the workflow to detect that and jump to the next one. Add a second sheet tab with rep availability flags and filter the rep list before running the modulo calculation.

Connecting to Pipedrive's API

The Pipedrive Update Deal node needs the deal ID (passed from the trigger) and the user_id of the assigned rep. You get rep user IDs from Pipedrive's /v1/users endpoint — run it once manually, copy the IDs, and hardcode them in your Function node array.

For the notification, include these fields in the message:

  • Deal title and ID
  • Company name (if available)
  • Deal value
  • Direct link to the deal: https://app.pipedrive.com/deal/DEAL_ID

Reps should be able to open the deal in one tap from their phone. Remove any friction between notification and first contact — that's where response time is actually lost.

Testing and Going Live

Before activating the webhook, test the workflow manually by creating a test deal in Pipedrive and running the workflow with that deal's data. Verify the rotation counter increments correctly across three consecutive runs. Check that the deal owner in Pipedrive actually changes — not just in the n8n output, but in the Pipedrive UI itself.

Then activate the webhook and create one real deal. Watch the logs. Confirm the notification fires. If everything runs clean, you're done.

If you want to skip the build entirely, there are ready-made n8n templates that include this rotation logic pre-wired with Pipedrive, Google Sheets, and Slack — tested and documented, ready to import and configure with your own credentials in minutes.

Deal rotation is one of those automations that pays back immediately. Once it's running, your team stops thinking about assignment fairness and starts focusing on closing. The workflow runs in the background, silent, accurate, and consistent — exactly what operational automation should be.

Pipedrive Stage - Follow-up Email
PRONTO PARA USAR

Ja construimos isso pra voce

Nao comece do zero. O Pipedrive Stage - Follow-up Email e um workflow n8n pronto para instalar que faz exatamente isso — em minutos, nao horas.

Instalar por $39 →