Skip to content

On a schedule

Hear when texts start failing

Failed or undelivered messages are posted with their error codes, so you can spot a problem with a number or carrier early.

Runs
On a schedule
Apps
Twilio
AI
Not needed
Access
read

Send this to your assistant

Create a ClickRuntime automation: every 15 minutes, check for Twilio messages that failed or weren't delivered and post the recipients and error codes to #ops in Slack.

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

Customers say they never got the code or the delivery update, and the business has no idea why. Twilio messages fail for specific reasons, such as an invalid number, a carrier block or an unregistered sender, and the failures cluster. A one-hour spike of undelivered texts to one carrier could mean hundreds of customers did not receive their verification code, and nobody is told until the support tickets pile up.

On a regular check, this lists the messages sent since the last check that ended up failed or undelivered, and posts to Slack if there are any. You find out when delivery starts breaking, with the count and an example, instead of when customers complain.

It is useful for any team that sends login codes, order updates or appointment reminders by text.

What you get out of it

  • Delivery problems are found by you

    You hear about failed messages before customers write in. That lets you switch providers, fix a number format or contact Twilio support while the problem is still small. Fixing it early means fewer unhappy customers to apologize to.

  • Protects logins and checkout

    Text codes block users when they fail. Detecting a spike in failures quickly means fewer abandoned sign-ups and fewer customers locked out at the moment they are trying to pay.

  • Clusters point to the cause

    Seeing that failures share a country, carrier or error code narrows the investigation. You skip hours of guessing and can send precise details when contacting support. Support then gets a precise report instead of a vague complaint.

  • Only alerts when there is a problem

    No failed messages means no post. The channel stays quiet on healthy days, so a message there is treated as important instead of being scrolled past as noise. That keeps the alert meaningful and the channel trusted.

  • Saves money on wasted sends

    Failed texts can still cost money. Stopping a bad send early, for example to a list with invalid numbers, avoids paying again and again for messages that were never delivered.

How it works

What happens, step by step

  1. Every 15 minutes, ClickRuntime checks your Twilio account for text messages that failed or were not delivered since the last check.

  2. Each failure is reported only once.

  3. If there are any, it posts them to your #alerts Slack channel with the number, the status and the error code, so you can spot a problem with a number or carrier early.

Before it runs live

  • Connect Twilio

What you get

RunsOn a schedule
Hear when texts start failingtoday, 9:00Succeeded
Slack · #alertsFailed SMS: +447700900999: undelivered (error 30003) +15555550123: failed (error 21610)

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

  • Act only on the items that match your own rules, and skip the rest
  • 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 Twilio 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.
failed_message_alert.pyexample
from email.utils import parsedate_to_datetime
from clickruntime import on_trigger, credentials, http, state, notify, report_fetched

@on_trigger
def run(event):
    sid = credentials.secret("TWILIO_ACCOUNT_SID")
    msgs = http.get(f"https://api.twilio.com/2010-04-01/Accounts/{sid}/Messages.json",
                    auth=(sid, credentials.secret("TWILIO_AUTH_TOKEN")), params={"PageSize": 200}).json()["messages"]
    since = state.get("since") or ""
    bad = [m for m in msgs if m["status"] in ("failed", "undelivered") and m["date_updated"]
           and parsedate_to_datetime(m["date_updated"]).isoformat() > since]
    report_fetched(len(bad))
    if not bad:
        return {"summary": "Nothing new"}
    notify.slack("Failed SMS:\n" + "\n".join(f"{m['to']}: {m['status']} (error {m['error_code']})" for m in bad), channel="#alerts")
    state.set("since", max(parsedate_to_datetime(m["date_updated"]).isoformat() for m in bad))
    return {"failed": len(bad)}

FAQ

Common questions

What counts as failed?
Messages that Twilio reports with a status of failed or undelivered. Messages still queued or in transit are not counted until their final status is known, so there is a short delay before a problem shows up.
How often is it checked?
On a regular schedule you pick, such as every 15 minutes. Shorter intervals alert you sooner, while longer ones group failures into fewer messages. Most teams choose a schedule that matches how quickly they can react.
Will one failed number set off an alert?
Yes, by default any failure triggers a post. If a single bad number is not worth waking anyone, you can set a minimum count, such as five failures in a check, before an alert is sent.
What permissions does it need?
read. 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 checks. Checks that find nothing new 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 texts start failing” from your assistant

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