Schedule icon
List icon
Loop icon
If icon
DiscordIncomingWebhook icon

Detect Stale Pipedrive Deals Weekly and Alert Discord per Deal

Find stale Pipedrive deals on a schedule with Kestra. List open deals, flag any past their expected close date, and report each one to Discord.

Categories
Business

Deals do not fail loudly. They fail by sitting in a stage past the date everyone agreed they would close, while the forecast quietly stops being true. This blueprint runs a weekly sweep with io.kestra.plugin.pipedrive.deals.List, iterates every open deal with io.kestra.plugin.core.flow.Loop, and posts one Discord message per deal whose expected close date has already passed. Each alert names the deal, its value, and the missed date, so the Monday standup starts with a concrete list instead of a gut feeling.

How it works

  1. list_open_deals (io.kestra.plugin.pipedrive.deals.List, fetchType: FETCH, status: open) pulls up to 100 open deals into the execution as {{ outputs.list_open_deals.deals }}.
  2. loop_deals (io.kestra.plugin.core.flow.Loop) fans out over the deal list; inside the loop each deal is decoded with fromJson(item.value).
  3. flag_if_stale (io.kestra.plugin.core.flow.If) checks that the deal carries an expectedCloseDate and that the date, converted with the timestamp filter, is earlier than now(). Deals without an expected close date are deliberately skipped, keeping the check conservative and free of false alarms.
  4. report_stale_deal posts one Discord message per hit, reading the deal fields through item.value, which is accessible from any depth inside the Loop, including inside the If.
  5. The errors block posts a distinct Discord alert if the sweep itself fails, and a disabled-by-default Schedule trigger runs the sweep every Monday at 08:00.

What you get

  • A per-deal alert, not a summary, so each stale deal gets an owner and a decision.
  • A conservative staleness rule based on the date the deal itself promised, not an arbitrary inactivity window.
  • A pipeline review that happens whether or not anyone remembered to run it.
  • A failure alert that distinguishes a healthy pipeline from a sweep that never ran.

Who it's for

  • Sales managers whose weekly pipeline review keeps finding deals that expired weeks ago.
  • Revenue operations teams turning forecast hygiene into an automated control instead of a recurring meeting agenda item.
  • Founders running sales from Discord who want CRM signals delivered where the team already is.

Why orchestrate this with Kestra

Pipedrive stores the expected close date but does not chase it for you. Kestra turns that dormant field into an active control: a scheduled sweep, per-deal branching logic, and channel delivery, all declared in YAML with execution history showing exactly which deals were flagged in every run. Changing the staleness rule is editing one Pebble expression, not rebuilding a workflow in a UI.

Prerequisites

  • A Pipedrive account and API token.
  • Open deals with the expected close date field populated, since deals without it are skipped.
  • A Discord incoming webhook for alerts.

Secrets

  • PIPEDRIVE_API_TOKEN: Pipedrive API token.
  • DISCORD_WEBHOOK_URL: Discord incoming webhook URL.

Quick start

  1. Add both secrets to your Kestra namespace.
  2. Execute the flow once manually and confirm a Discord message appears for any open deal with a past expected close date.
  3. Set disabled: false on the weekly trigger and adjust the cron to land before your pipeline review.

How to extend

  • Raise the limit or pass the nextCursor output into a follow-up run to cover pipelines larger than one page.
  • Scope the sweep with pipelineId, stageId, or ownerId on the list task to give each team its own alert channel.
  • Chain io.kestra.plugin.pipedrive.deals.Update inside the If branch to push the deal into a review stage or drop its probability automatically.
  • Widen the condition to also catch deals whose expected close date is within the next seven days for an early-warning variant.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.