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.
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
Every morning, ClickRuntime checks your Twilio account for yesterday's text messages.
It counts how many went out, how many failed, and what they cost.
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
Build your own
Need it to work differently?
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
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?
Is yesterday's usage final the next morning?
Can I get separate numbers per subaccount?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Get a text when your site goes down
You get one SMS when a check fails and another when it recovers, without repeats in between.
See how it worksGet warned before your Twilio balance runs out
You get one alert when the balance drops below your limit, and no more until it's topped up.
See how it worksCatch an unusual jump in Twilio spend
If today's texts or calls cost far more than usual, you're alerted with a breakdown, which can be an early sign of fraud.
See how it worksKeep exploring
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.