Skip to content

Daily

Get yesterday's SMS count and spend each morning

One email a day tells you how many texts went out, how many failed and what it cost.

Runs
Daily
Apps
Twilio
AI
Not needed
Access
read

Send this to your assistant

Create a ClickRuntime automation: every morning at 7, email me yesterday's Twilio SMS count, the number that failed, and the total spend.

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

Twilio bills by the message, and costs can change faster than anyone notices. A script that loops, a campaign that goes to the wrong list or a change in carrier fees can double your daily spend, but the invoice only shows up weeks later. By then an agency or a SaaS team has paid for texts that did nothing, and failed messages were quietly paid for too.

Each morning, this reads Twilio's usage records for the previous day, counts how many texts were sent and how many failed, adds up the cost and emails you the numbers. Spend and delivery quality are in your inbox every day, not just on the invoice.

Anyone who sends texts at scale, from a few hundred to many thousands, will get value from it.

What you get out of it

  • Cost surprises appear the next morning

    A runaway process that sends ten times the usual volume shows up as a clear number the next day. You can stop it after one day of waste, not after a whole billing cycle.

  • Failures are counted

    The number of failed messages sits next to the sent count. A rising failure rate means customers are not getting texts that you are paying for, and that deserves a look at once.

  • Daily spend you can budget against

    Seeing a cost per day makes it easy to compare with your monthly budget. Finance teams can forecast the bill from actual spend instead of guessing from the previous invoice.

  • Evidence for pricing and billing

    If you pass SMS costs to customers, daily records support your charges. You can show exactly how many messages were sent on behalf of an account and what they cost.

  • Impact of campaigns is visible

    After sending a promotion, the next report shows the volume and cost it caused. That helps you judge whether a campaign was worth what you spent on messaging. Marketing and finance can then agree on whether the spend was justified.

How it works

What happens, step by step

  1. Every morning, ClickRuntime checks your Twilio account for yesterday's text messages.

  2. It counts how many went out, how many failed, and what they cost.

  3. You get one short email with the three figures, such as "Sent: 1,284, Failed: 9, Cost: 10.27 USD".

Before it runs live

  • Connect Twilio

What you get

RunsDaily
Get yesterday's SMS count and spend each morningtoday, 9:00Succeeded
Email · Twilio SMS yesterdaySent: 1,284 Failed: 9 Cost: 10.27 USD

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 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.
daily_sms_usage_cost_report.pyexample
from datetime import date, timedelta
from clickruntime import on_trigger, credentials, http, notify

@on_trigger
def run(event):
    sid = credentials.secret("TWILIO_ACCOUNT_SID")
    base, auth = f"https://api.twilio.com/2010-04-01/Accounts/{sid}", (sid, credentials.secret("TWILIO_AUTH_TOKEN"))
    rec = http.get(f"{base}/Usage/Records/Yesterday.json", auth=auth, params={"Category": "sms"}).json()["usage_records"]
    count = int(rec[0]["count"]) if rec else 0
    cost = f"{float(rec[0]['price']):.2f} {rec[0]['price_unit'].upper()}" if rec else "0.00"
    failed = http.get(f"{base}/Messages.json", auth=auth, params={
        "Status": "failed", "DateSent": str(date.today() - timedelta(days=1)), "PageSize": 1000}).json()["messages"]
    notify.email_me("Twilio SMS yesterday", f"Sent: {count}\nFailed: {len(failed)}\nCost: {cost}")
    return {"sent": count, "failed": len(failed)}

FAQ

Common questions

Which costs are included in the figure?
The report uses the usage records Twilio provides for the day, which cover the cost of messages. Other charges such as phone number rental or voice minutes can be added if you ask for those categories.
Is yesterday's usage final the next morning?
Usually, but Twilio can finalize some records with a small delay, so a number can change slightly. For billing-grade accuracy, use the invoice, and treat the daily email as a very good early indicator. That caveat is small for most accounts.
Can I get separate numbers per subaccount?
Yes, if you use Twilio subaccounts, the usage can be read per subaccount. That is useful for agencies who run messaging for multiple clients and need to see which client generated each day's cost. Each subaccount gets its own line in the email.
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 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 yesterday's SMS count and spend each morning” from your assistant

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