Skip to content

Daily

Get an email when deals start to stall

Each day you get an email listing newly at-risk deals, with the warning signs for each.

Runs
Daily
Apps
Gmail, Salesforce
AI
Optional
Access
api; gmail.send

Send this to your assistant

Create a ClickRuntime automation: every day, check open Salesforce opportunities for a past close date, repeated pushes, no activity in 3 weeks or no next step, and email me deals with two or more of these.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

A founder who still runs sales doesn't have time to review the pipeline every day, but a deal that slips unnoticed for a month can mean a missed payroll target. The signs are simple: the close date passed, it's been pushed twice, nobody has spoken to the customer in weeks.

This automation checks every open deal each day for those signs and emails you the ones showing two or more. You're only told about each deal once, when it first becomes risky.

What you get out of it

  • Only new problems

    A deal is emailed when it first turns risky, not every day after, so the email stays short.

  • Clear reasons

    Each deal lists exactly which warning signs it shows.

  • Predictable rules

    The checks are fixed and easy to explain, with no AI cost.

  • Straight to your inbox

    The email comes from your own Gmail, with a link to each deal.

How it works

What happens, step by step

  1. Every day the automation reads your open opportunities from Salesforce.

  2. It checks each one for four warning signs: past close date, repeated pushes, three quiet weeks, and no next step.

  3. Deals showing two or more signs are flagged, and any already emailed are skipped.

  4. You get an email from your Gmail account listing the new risky deals with links.

Before it runs live

  • Connect Google through your own Google app (a one-time, 10-minute setup), so it works with your own Gmail
  • Connect Salesforce

What you get

RunsDaily
Get an email when deals start to stalltoday, 9:00Succeeded
Email · Deal riskContoso data migration (Proposal, 48,000): close date has passed; no activity in 3 weeks

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • Your own rules

    Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.

  • Any number of apps

    One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.

  • AI where it helps

    Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.

  • On a schedule or on each event

    Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.

Changes you can ask for

  • Run it at a different time, more or less often, or only on weekdays
  • Change what the AI looks for, or how it writes the result
  • Add another app, for example also send it to Slack
  • Combine it with other Gmail and Salesforce steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
deal_risk_alert_email.pyexample
import base64
from email.message import EmailMessage
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from datetime import date
from clickruntime import on_trigger, credentials, http, state
ME, INSTANCE = "me@northwind.example", "https://yourcompany.my.salesforce.com"
def send(subject, body):
    msg = EmailMessage()
    msg["To"], msg["Subject"] = ME, subject
    msg.set_content(body)
    gmail = build("gmail", "v1", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
    gmail.users().messages().send(userId="me", body={"raw": base64.urlsafe_b64encode(msg.as_bytes()).decode()}).execute()
@on_trigger
def run(event):
    headers = {"Authorization": f"Bearer {credentials.connection('salesforce', 'work')}"}
    opps = http.get(f"{INSTANCE}/services/data/v61.0/query", headers=headers, params={"q": "SELECT Id, Name, Amount, StageName, CloseDate, "
                    "PushCount, LastActivityDate, NextStep FROM Opportunity WHERE IsClosed = false LIMIT 500"}).json()["records"]
    flagged = []
    for o in opps:
        reasons = [why for hit, why in [(o["CloseDate"] < date.today().isoformat(), "close date has passed"),
                   ((o["PushCount"] or 0) >= 2, f"close date pushed {o['PushCount']} times"),
                   ((date.today() - date.fromisoformat(o["LastActivityDate"] or "2000-01-01")).days > 21, "no activity in 3 weeks"), (not o["NextStep"], "no next step")] if hit]
        if len(reasons) >= 2:
            flagged.append((o, reasons))
    new = [(o, r) for o, r in flagged if o["Id"] not in set(state.get("sent") or [])]
    if new:
        send(f"{len(new)} deals look at risk", "\n\n".join(f"{o['Name']} ({o['StageName']}, {o['Amount']}): {'; '.join(r)}\n{INSTANCE}/{o['Id']}" for o, r in new))
    state.set("sent", [o["Id"] for o, _ in flagged])
    return {"risky": len(flagged), "emailed": len(new)}

FAQ

Common questions

What are the warning signs?
Close date in the past, close date pushed two or more times, no activity in 21 days, and no next step. A deal needs two of these to be flagged.
Will I hear about the same deal again?
Not while it stays risky. If it recovers and later becomes risky again, it's included again.
Can it use AI to judge risk?
Yes. Ask for an AI check that reads the next step and recent activity and gives a reason in plain words.
What permissions does it need?
api; gmail.send. Nothing else in your accounts is used.
Does it need AI?
No, but you can ask for an AI step (for example a summary). It then uses ClickRuntime's built-in AI allowance.
How many runs does it use?
One run each time it runs (daily). Checks that find nothing to do and stop right away aren't counted.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Get an email when deals start to stall” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.