Skip to content

Daily

Hear when a big deal starts looking risky

Each day your large Salesforce deals get a risk score, and the owner gets a Slack message when one jumps, with the reason.

Runs
Daily
Apps
Salesforce, Slack
AI
Yes, uses the built-in AI allowance
Access
api; chat:write, users:read.email

Send this to your assistant

Create a ClickRuntime automation: every day, score open Salesforce deals over $20k for risk from 1 to 10, and DM the owner in Slack when a deal's score goes up by 2 or more, saying why.

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

On a team with a handful of large deals each quarter, one slipping can decide the number. The warning signs, like a pushed close date, a missing next step or two quiet weeks, build up gradually, and the owner is often the last to admit the deal is in trouble.

This automation scores every open deal over $20k each day and remembers yesterday's score. When a deal's risk jumps, the owner gets a direct message in Slack explaining why, while there's still time to do something.

What you get out of it

  • Alerts on change, not noise

    Owners only hear about a deal when its risk rises noticeably, so the messages stay worth reading.

  • A reason with every score

    Each message says what changed, like the close date being pushed again, so the owner knows what to fix.

  • Private to the owner

    The message goes to the deal owner as a direct message, not a public channel, which keeps the tone helpful.

  • Focus on the deals that matter

    Only deals above your size threshold are scored, so attention goes where the revenue is.

How it works

What happens, step by step

  1. Every day the automation finds open Salesforce deals worth more than $20k.

  2. AI gives each one a risk score from 1 to 10 with a one-line reason.

  3. It compares each score with the one from the previous run.

  4. If a score has risen by 2 or more, the deal owner gets a direct message in Slack.

Before it runs live

  • Connect Salesforce
  • Connect Slack, then invite the app to the channel (type /invite @ClickRuntime there)

What you get

RunsDaily
Hear when a big deal starts looking riskytoday, 9:00Succeeded
Slack · Direct messageRisk on Northwind Logistics expansion went from 4 to 7/10: close date pushed for the third time and no next step set.

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 Google Sheets
  • Combine it with other Salesforce and Slack 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.
ai_deal_risk_score_with_slack_alerts.pyexample
from slack_sdk import WebClient
from clickruntime import on_trigger, credentials, http, state, ai
INSTANCE = "https://yourcompany.my.salesforce.com"
API = f"{INSTANCE}/services/data/v61.0"

def soql(headers, q):
    return http.get(f"{API}/query", headers=headers, params={"q": q}).json()["records"]
SCHEMA = {"type": "object", "properties": {"score": {"type": "integer"}, "reason": {"type": "string"}},
          "required": ["score", "reason"]}
@on_trigger
def run(event):
    headers = {"Authorization": f"Bearer {credentials.connection('salesforce', 'work')}"}
    deals = soql(headers, "SELECT Id, Name, Amount, StageName, CloseDate, PushCount, NextStep, LastActivityDate, "
                 "Owner.Email FROM Opportunity WHERE IsClosed = false AND Amount > 20000 ORDER BY Amount DESC LIMIT 40")
    slack = WebClient(token=credentials.connection("slack", "work"))
    scores, alerted = state.get("scores") or {}, 0
    for d in deals:
        r = ai.generate(f"Rate the risk of this deal slipping or being lost, 1 (safe) to 10, with a one-line reason.\n"
                        f"{d['Name']} | {d['Amount']} | {d['StageName']} | close {d['CloseDate']} | pushed {d['PushCount']} times | "
                        f"next step: {d['NextStep'] or 'none'} | last activity {d['LastActivityDate'] or 'never'}",
                        json_schema=SCHEMA, max_output_tokens=80).json
        before = scores.get(d["Id"])
        if before is not None and r["score"] - before >= 2:
            user = slack.users_lookupByEmail(email=d["Owner"]["Email"])["user"]["id"]
            slack.chat_postMessage(channel=user, text=f"Risk on <{INSTANCE}/{d['Id']}|{d['Name']}> went from "
                                                      f"{before} to {r['score']}/10: {r['reason']}")
            alerted += 1
        scores[d["Id"]] = r["score"]
    state.set("scores", scores)
    return {"scored": len(deals), "alerted": alerted}

FAQ

Common questions

How does it find the owner in Slack?
It looks up the Slack user by the owner's Salesforce email address, so the two need to match. It posts through your own Slack app, which needs permission to read user emails and send messages.
What does the risk score look at?
Stage, amount, close date, how many times the close date has been pushed, the next step and the last activity date.
Why didn't I get a message on the first day?
The first run sets a baseline score for each deal. Messages start from the next run, when a score rises by 2 or more.
What permissions does it need?
api; chat:write, users:read.email. Nothing else in your accounts is used.
Does it need AI?
Yes. It uses ClickRuntime's built-in AI, so you don't need an OpenAI or Anthropic key. Every plan includes a monthly 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 “Hear when a big deal starts looking risky” from your assistant

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