# New Community Node: n8n-nodes-do-while — The Missing Do...While Loop for n8n

**URL:** <https://community.n8n.io/t/new-community-node-n8n-nodes-do-while-the-missing-do-while-loop-for-n8n/293944>\
**Category:** Built with n8n\
**Tags:** data-transformation, looping, community-node, loop-over-items\
**Created:** [May 4, 2026, 9:45am UTC](https://community.n8n.io/t/new-community-node-n8n-nodes-do-while-the-missing-do-while-loop-for-n8n/293944 "2026-05-04T09:45:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![w\_i\_z\_a\_r\_d](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/w_i_z_a_r_d/32/169120_2.png) [@w\_i\_z\_a\_r\_d](https://community.n8n.io/u/w_i_z_a_r_d)\
**Post date:** [May 4, 2026, 9:45am UTC](https://community.n8n.io/t/new-community-node-n8n-nodes-do-while-the-missing-do-while-loop-for-n8n/293944/1 "2026-05-04T09:45:15Z")

</div>

Hi everyone!

I want to share my first community node: **n8n-nodes-do-while** — a do…while loop for n8n workflows.

## What does it do?

n8n’s Loop Over Items node is great when you have a known list of items to iterate over. But sometimes you do not have a list. You just need to keep running until something becomes true:

- A background job finishes processing
- An API call eventually returns success
- A database record finally appears
- An async task reaches a ready state

That is the do…while pattern. It is one of the most fundamental control flow constructs in programming, and this node brings it natively to n8n.

## How it works

The node has two output pins:

- **Condition Met** — items exit here when your condition evaluates to true, or when max iterations is reached
- **Loop** — items exit here when your condition is false. Connect this to your action nodes and route them back into the Do…While input

[Do…While] Condition Met → continue your workflow Loop → your action nodes → back to Do…While

Each item gets a `_loop` metadata object injected automatically:

| Field | Description |
| --- | --- |
| `$json._loop.iteration` | How many times this item has looped |
| `$json._loop.first` | True on the first iteration |
| `$json._loop.timedOut` | True if max iterations was reached |

## Key features

- Condition expression using standard n8n expression syntax evaluated against live workflow data
- Configurable wait between iterations — set to 5 seconds when polling an API, 0 for immediate retry
- Max iterations safety cap so you never get an infinite loop
- Graceful timeout handling — items exit via Condition Met with `_loop.timedOut = true` so you can branch with an IF node
- Zero runtime dependencies
- Works with any node inside the loop — HTTP Request, Postgres, Code, anything

## Real use cases

**Poll a video processing API until encoding is complete**

Do…While (condition: $json.status === ‘complete’, wait: 5s) Loop → HTTP Request: check encoding status → back to Do…While Condition Met → fetch and deliver the result

**Retry a webhook call until the third-party responds**

Do…While (condition: $json.success === true, max: 5, wait: 3s) Loop → HTTP Request: retry the call → back to Do…While Condition Met → continue workflow

**Wait for a Postgres record before sending a confirmation**

Do…While (condition: $json.data !== null, wait: 10s, max: 12) Loop → Postgres: SELECT \* FROM orders WHERE id = ‘123’ → back to Do…While Condition Met → send confirmation email

## Demo

[![](https://img.youtube.com/vi/OqRvcMm2aSc/maxresdefault.jpg "I Built the Missing Do...While Loop Node for n8n (Poll APIs, Retry Requests, Wait for Conditions)") ](https://www.youtube.com/watch?v=OqRvcMm2aSc)

## Try it yourself

Here is a working example workflow you can import directly. It simulates a job that takes 3 checks to complete, then exits cleanly with the result and iteration count.

Replace the “Check Job Status” Code node with an HTTP Request to your own API status endpoint and update the condition to match your response shape.

## Installation

npm install n8n-nodes-do-while

Or via Settings \> Community Nodes \> Install and search for `n8n-nodes-do-while`. Restart n8n after installing.

## Requirements

- n8n version 0.198.0 and above
- Self-hosted n8n
- No external accounts or credentials needed

## Why I built this

I kept running into the same problem building automation workflows. I needed to poll an external service and wait for a response before continuing. The workarounds I found involved recursive Code nodes or Wait loops that were fragile and hard to read.

The do…while pattern solves this cleanly. Getting the condition expression evaluation and state management right across iterations took some work, but the result is a node that feels native and wires up like anything else in n8n.

## Links

- Demo: [https://youtu.be/OqRvcMm2aSc](https://youtu.be/OqRvcMm2aSc)
- GitHub: [GitHub - victor-folorunso/n8n-nodes-do-while · GitHub](https://github.com/victor-folorunso/n8n-nodes-do-while)
- npm: [https://www.npmjs.com/package/n8n-nodes-do-while](https://www.npmjs.com/package/n8n-nodes-do-while)
- License: MIT

This is v0.1.0 so there will be rough edges. I would love feedback from anyone who tries it — what breaks, what the condition expression does not handle well, what use cases I have not covered. Happy to iterate quickly.

Thanks for being a great community!

---

<div class="post-metadata">

**Author:** ![Chrisbuildsai](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/chrisbuildsai/32/60660_2.png) [@Chrisbuildsai](https://community.n8n.io/u/Chrisbuildsai)\
**Post date:** [May 9, 2026, 11:41am UTC](https://community.n8n.io/t/new-community-node-n8n-nodes-do-while-the-missing-do-while-loop-for-n8n/293944/2 "2026-05-09T11:41:30Z")

</div>

This fills a real gap. I can see it being useful for async jobs where you need to poll until something is ready. The one thing I’d want is a hard max attempts setting so it can’t quietly loop forever. That’s the part that usually bites later.

---

<div class="post-metadata">

**Author:** ![w\_i\_z\_a\_r\_d](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/w_i_z_a_r_d/32/169120_2.png) [@w\_i\_z\_a\_r\_d](https://community.n8n.io/u/w_i_z_a_r_d)\
**Post date:** [May 9, 2026, 12:32pm UTC](https://community.n8n.io/t/new-community-node-n8n-nodes-do-while-the-missing-do-while-loop-for-n8n/293944/3 "2026-05-09T12:32:50Z")

</div>

Heyy chris  
you dont know how happy i am to hear this. its the joy of every developer to build something useful. thanks 😍  
that being said, the node has a max iterations setting in it for exactly this reason

you can check the docs here: [n8n-nodes-do-while - npm](https://www.npmjs.com/package/n8n-nodes-do-while)  
and find examples here: [n8n-nodes-do-while/examples at main · victor-folorunso/n8n-nodes-do-while · GitHub](https://github.com/victor-folorunso/n8n-nodes-do-while/tree/main/examples)  
i also have a youtube video on it here: [https://www.youtube.com/watch?v=OqRvcMm2aSc](https://www.youtube.com/watch?v=OqRvcMm2aSc)  
and in also working on publishing workflows on it too 😅😅  
i gat you covered

let me know if there is anything else. happy to help 😉

---

<div class="post-metadata">

**Author:** ![w\_i\_z\_a\_r\_d](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/w_i_z_a_r_d/32/169120_2.png) [@w\_i\_z\_a\_r\_d](https://community.n8n.io/u/w_i_z_a_r_d)\
**Post date:** [May 9, 2026, 12:35pm UTC](https://community.n8n.io/t/new-community-node-n8n-nodes-do-while-the-missing-do-while-loop-for-n8n/293944/4 "2026-05-09T12:35:12Z")

</div>

oh… also if you could help spread the word i would be more than pleased 😅😅  
working on another interesting node as we speak… n8n just got more fun for me
