Query icon
ForEach icon
If icon
Move icon
DiscordIncomingWebhook icon
Schedule icon

Move Stale monday.com Items into a Stale Group on a Weekly Sweep

Keep monday.com boards honest with Kestra. Query items weekly, detect anything untouched beyond a staleness window, move it to a stale group, report to Discord.

Categories
Business

Boards rot quietly: items nobody touched in weeks sit between active work and make every standup slower. This blueprint runs a weekly sweep with io.kestra.plugin.monday.items.Query fetching every item and its updated_at timestamp, a ForEach plus If pair applying a simple staleness rule, and io.kestra.plugin.monday.items.Move parking offenders in a dedicated stale group. Discord gets a summary, and the active groups go back to showing only work that moves.

How it works

  1. list_items (io.kestra.plugin.monday.items.Query, fetchType: FETCH) pulls up to 500 items from the board. Each element in {{ outputs.list_items.items }} carries id, name, state, created_at, updated_at, its group, and its column_values, and {{ outputs.list_items.size }} carries the count.
  2. sweep (io.kestra.plugin.core.flow.ForEach) iterates the items. Inside the loop, check_staleness (io.kestra.plugin.core.flow.If) converts the item's updated_at and the cutoff to epoch seconds with the timestamp filter and compares them: (updated_at | timestamp) < (now() | dateAdd(-N, 'DAYS') | timestamp). A missing timestamp falls back to now() via ??, so such items are treated as fresh rather than moved by accident.
  3. Matching items are moved by move_to_stale (io.kestra.plugin.monday.items.Move). Because it is nested inside the If, the item id is read from {{ fromJson(parent.taskrun.value).id }}.
  4. report posts the scan summary to Discord, and the errors block posts a distinct alert when the sweep itself fails.
  5. A disabled-by-default Schedule trigger runs the sweep every Monday at 07:00.

What you get

  • A board where the active groups reflect reality, enforced weekly without anyone nagging.
  • A simple, documented staleness rule based on the item-level updated_at field the monday.com API returns for every item.
  • Safe defaults: items missing a timestamp are skipped, not swept.
  • A Discord record of every sweep and an alert when tidying breaks.

Who it's for

  • Team leads whose boards accumulate items that stopped moving weeks ago.
  • Ops teams enforcing work-in-progress hygiene across many boards.
  • Anyone replacing a manual Friday cleanup ritual with a scheduled flow.

Why orchestrate this with Kestra

monday.com automations can act on single-item events, but a periodic full-board sweep with a computed date rule, a loop, and an audit trail is orchestration work. Kestra runs the query on schedule, applies one rule uniformly to every item, retries transient API errors, and keeps each sweep's execution history for review.

Prerequisites

  • A monday.com board to sweep, plus a stale group created on it (the stale_group_id input takes the group id).
  • A Discord incoming webhook for summaries and failure alerts.

Secrets

  • MONDAY_API_TOKEN: monday.com personal API v2 token, from Profile, Developers, My Access Tokens.
  • DISCORD_WEBHOOK_URL: Discord incoming webhook URL.

Quick start

  1. Add the two secrets to your Kestra namespace.
  2. Set board_id and stale_group_id to your board and its stale group.
  3. Execute the flow once and verify old items landed in the stale group.
  4. Set disabled: false on the weekly trigger.

How to extend

  • Archive instead of move by swapping items.Move for io.kestra.plugin.monday.items.Archive.
  • Post a warning update on each stale item first with io.kestra.plugin.monday.updates.Create, and only move on the next sweep.
  • Narrow the sweep to a subset of items by passing monday.com queryParams rules to items.Query.
  • Sweep several boards by wrapping the flow body in an outer ForEach over a list of board ids.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.