The Loop node repeats actions for every item in a collection (like a list of posts, leads, or mentions). Instead of processing items one at a time manually, the Loop node automatically runs through your entire collection and performs the same actions on each item.

Think of it like a production line: you have a batch of items (posts, leads, etc.), and the Loop node processes each one through the same set of steps without you having to manually trigger each action.

Loop Behavior:

The Loop node has two main execution paths that you can connect to different actions:

  • For Each Item: This path executes connected actions once for each item in your collection. If you have 10 posts, the actions connected here will run 10 times β€” once per post. This is where you put actions that need to happen for every individual item (like analyzing sentiment or enriching data).

  • Completed: This path executes only once, after all items have been processed. This is useful for actions that should happen after the entire batch is done β€” like sending a summary email or creating a final report.

Available Outputs Inside the Loop

When you're working inside a Loop node, you have access to special variables that help you understand where you are in the process and access the data you need:

  • currentItem β†’ The item currently being processed. This is the actual data for the current loop iteration. For example, if you're looping through posts, currentItem would contain the post content, author, URL, etc. for whichever post is being processed right now.

  • currentIndex β†’ The index of the item (0-based). This tells you which position you're at in the collection. The first item is index 0, the second is index 1, and so on. Useful if you need to number items or perform actions only on specific positions.

  • totalItems β†’ Total number of items in the collection. This tells you how many items will be processed in total. For example, if you're looping through 25 Reddit posts, totalItems would be 25.

  • collection β†’ The full collection. This gives you access to all items at once, not just the current one. Useful if you need to compare the current item to others or access data from multiple items.

  • isCompleted β†’ Whether the loop has finished running. Returns true when all items have been processed, false while still looping. This is primarily used in the "Completed" path to confirm the loop is done.

Use cases

  • Process every new Reddit post: When your listening search finds 20 new Reddit posts mentioning your product, use a Loop to analyze the sentiment of each post individually, then send all negative sentiment posts to your support team.

  • Run sentiment analysis on a batch of mentions: If you have a collection of social media mentions, loop through each one to determine if it's positive, negative, or neutral. After the loop completes, generate a summary report showing the overall sentiment breakdown.

  • Enrich and summarize leads: Loop through a list of potential leads, enriching each one with additional company data (like employee count, revenue, industry). Once all leads are enriched, use the "Completed" path to create a summary report of the most promising leads and send it to your sales team.

Example Workflow: You find 15 competitor mentions on Reddit. Your Loop node processes each mention β†’ runs sentiment analysis β†’ checks if it indicates buying intent β†’ if yes, creates a lead in your CRM. After all 15 are processed, the "Completed" path sends a Slack message to your sales team: "15 competitor mentions analyzed, 4 high-intent leads created."

Pro tip: Pair Loops with the General Agent β€” research each competitor mention individually, then run a summary once the loop is completed.