AcademyWorkflowsDevelopment

Add a check condition for a loop in n8n

Automation builders who need a safe stop condition when a workflow repeats a step.

  • Recommendedour rating
  • 9,551views on n8n
Open on n8n.io ↗

Paste it straight onto an n8n canvas with Ctrl+V or Cmd+V.

add-a-check-condition-for-a-loop-in-n8n.json

Loading the file...

What it does

A small n8n example that shows how to use the $runIndex expression to stop a loop from running forever. As a demo, it posts 5 tweets with the text 'Hello from n8n!'. You can swap the Twitter node for any other node and change the condition in the IF node.

Use cases

  1. 01Limit how many times a node repeats
  2. 02Learn how $runIndex works in an IF node
  3. 03Reuse the loop pattern with another app node

Connects

X (Formerly Twitter)

Questions about
Add a check condition for a loop in n8n.

What is Add a check condition for a loop in n8n used for?

Automation builders who need a safe stop condition when a workflow repeats a step. A small n8n example that shows how to use the $runIndex expression to stop a loop from running forever. As a demo, it posts 5 tweets with the text 'Hello from n8n!'. You can swap the Twitter node for any other node and change the condition in the IF node.

How do I import Add a check condition for a loop in n8n into n8n?

Copy the workflow JSON from this page and paste it onto the n8n canvas with Ctrl+V or Cmd+V. Then connect your credentials in each node.

Is Add a check condition for a loop in n8n safe to use?

It passed our automatic scan for credential theft, hidden instructions and risky install commands. Third party open source software. Sabemos AI does not maintain it. Check the code and permissions before you connect it to company data.