Skip to content

Hourly

Hear when a Segment destination starts failing

Within the hour, you know which destination is failing deliveries instead of finding gaps in a report later.

Runs
Hourly
Apps
Segment
AI
Not needed
Access
Public API token

Send this to your assistant

Create a ClickRuntime automation: every hour, check delivery metrics for my Segment destinations and message me in Slack if any destination has failed deliveries.

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

Segment sits between a company's apps and the tools that depend on its data: the ad platforms, the warehouse, the email tool, the CRM. When one destination starts failing, nothing visibly breaks in Segment. Events keep arriving. But Facebook conversions stop reaching the ad account, or the warehouse load fails on a schema change, and the damage is quiet. Campaigns run on incomplete data for days before an analyst notices that the numbers in one tool no longer match the others.

Every hour the automation gets delivery metrics for each destination in your workspace, compares the failure rate or failed count with a threshold you choose, and posts to Slack when one is above it. Healthy destinations produce no message at all. Data engineers and marketing operations people use it as a lightweight monitor on the pipes their reporting depends on.

What you get out of it

  • Ad spend is not wasted on bad data

    If conversion events stop reaching an ad platform, its optimization drifts. An hourly alert means the gap is hours long, not a week, and campaign budgets are not spent on stale signals.

  • Warehouse gaps are repaired sooner

    Failed deliveries to a warehouse leave holes in tables that analysts rely on. Learning of the failure within an hour makes replay or backfill easier and keeps dashboards trustworthy. One failed load on a Tuesday leaves a hole in every revenue table built on that day.

  • Root causes are easier to find

    A failure that starts at a known hour points to a specific change, like an expired API key or a renamed field. A short time window narrows the search to a handful of recent deploys.

  • Owners know which destination is affected

    The message names the destination, so the person who manages that tool can act. Nobody has to open the Segment workspace and click through every destination page to find the problem.

  • Silence means things are working

    The check posts only when a threshold is crossed, so the channel stays quiet on normal days. A message therefore carries weight and is read promptly, rather than being muted as noise.

How it works

What happens, step by step

  1. Every hour, ClickRuntime checks how many deliveries to each Segment destination failed in the last hour.

  2. It keeps the destinations whose failures are over the limit you set.

  3. If any are, your Slack channel gets a message listing each destination and how many deliveries failed.

Before it runs live

  • Connect Segment

What you get

RunsHourly
Hear when a Segment destination starts failingtoday, 9:00Succeeded
Slack · #dataSegment delivery failures in the last hour: • Amplitude: 1,482 failed deliveries

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
  • Add an AI step, for example to summarize, sort or draft a reply
  • Add another app, for example also send it to Slack
  • Combine it with other Segment 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.
destination_delivery_failure_check.pyexample
from clickruntime import on_trigger, credentials, http, state, notify

SOURCE_ID = "qwerty1234"
DESTINATIONS = {"dest_abc123": "Amplitude", "dest_def456": "BigQuery"}

@on_trigger
def run(event):
    headers = {"Authorization": f"Bearer {credentials.secret('SEGMENT_TOKEN')}"}
    alerted = state.get("alerted") or {}
    problems = []
    for dest_id, name in DESTINATIONS.items():
        data = http.get(f"https://api.segmentapis.com/destinations/{dest_id}/delivery-metrics",
                        headers=headers, params={"sourceId": SOURCE_ID, "granularity": "HOUR"}).json()
        summary = data["data"]["deliveryMetricsSummary"]
        failed = sum(m["total"] for m in summary["metrics"] if m["metricName"].startswith("discarded")
                     or m["metricName"].startswith("failed"))
        if failed and alerted.get(dest_id) != summary["endTime"]:
            problems.append(f"• {name}: {failed:,} failed deliveries")
            alerted[dest_id] = summary["endTime"]
    if problems:
        notify.slack("Segment delivery failures in the last hour:\n" + "\n".join(problems), channel="#data")
    state.set("alerted", alerted)
    return {"failing": len(problems)}

FAQ

Common questions

What counts as a delivery failure in Segment?
A failure is an event Segment tried to send to a destination and the destination rejected or errored on, such as an invalid API key or a payload the tool will not accept. Retries that eventually succeed are not counted as failures, only events that never arrived.
Can I set a different threshold for each destination?
Yes. An ad platform that rejects a few events daily can sit at 5 percent, while a warehouse might alert at one failure. Each destination gets its own line during setup, and a quiet one can be given a stricter rule than a noisy one.
Which Segment access is needed?
A Public API token with read access to the workspace, created in Segment settings. It never needs rights to edit sources or destinations. ClickRuntime keeps the token as a secret, and revoking it in Segment immediately stops the hourly check.
What permissions does it need?
Public API token. Nothing else in your accounts is used.
Does it need AI?
No. It runs without AI, so it doesn't use your plan's AI allowance.
How many runs does it use?
One run each time it runs (hourly). 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 Segment destination starts failing” from your assistant

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