viaSocket Help
DocStarBuilt with DocStar

Looping in workflows

Looping is a powerful feature that allows you to repeatedly run a specific action or set of actions for each item in a list.

viaSocket provides three different loop mechanisms.

1. Webhook Loop

A Webhook Loop happens when an incoming webhook sends multiple records/items in a single payload.

viaSocket automatically repeats the next step for each item that the webhook contains.

When to Use

Use webhook loops when:

• A webhook sends an array/list (e.g., orders, messages, leads).

• You want to process each item independently.

Example Use Cases

• Shopify → Webhook sends multiple line items

Each line item is processed separately.

• CRM → Webhook sends batch of leads

Each lead flows through the same sequence.

2. Loop in the Trigger

This loop executes when a trigger source (like a Google Sheet or Table) contains multiple rows/records.

viaSocket loops through each row and sends the data into the workflow one by one.


When to Use

Use trigger loops when:

• The trigger is a data store (Sheet/Table/API Pagination).

• You want the workflow to run for each record.

• Ideal when handling batch data or performing cron-based actions.

Example Use Cases

• Google Sheet → “For every row, generate a task”

• Table → “Every 30 minutes, process pending records”

• Cron Trigger → “Every 3rd day, send email to all unpaid customers”

3. Loop in the Action

The Action Loop is an AI-generated loop that is created when you instruct Ask-AI to “perform something for each item” of a list/array present in the workflow data.

Ask AI to build automatically:

1. Detects that the data is a list (array)

2.Creates a loop block

3. Iterates through each item in the array

How It Works

  1. In the previous step, you get an array (example: products, emails, urls, records, etc.).

  2. You click Ask AI to Build.

  3. In the prompt, you write something like:
    “Iterate over the array list called products and for each item send the details to XYZ action.”

  4. Ask AI to Build automatically creates:
    - A loop action block
    - A variable for each item

Example Use Cases

  1. API returns multiple items
    • Search API → returns 50 URLs
    • You want to rewrite each blog.
    • AI creates the entire loop.

  2. Scraper returns multiple links
    • Scraper → finds all internal links
    • AI loops through them and extracts data from each.

  3. Gmail API returns list of messages
    • AI loops over all message IDs and fetches full details.