Pre-built code blocks

Alerts by text and email

Owner alerts. Twilio SMS + email, dependency-free & fail-safe

For when the answer to “Text or email me when something breaks” is yes.

Text or email yourself when something matters (an export failed, the shared API key is out of credit) with no npm dependency and no risk to the request path: it never throws, owner() throttles so failures can't spam you, and it no-ops when unconfigured.

A small bell on a bracket with two cords running from it, one to a rounded tile and one to a sealed envelope, each cord fitted with a half closed valve

Skip the rebuild

You do not write this one. It arrives in your project as ordinary source you can read, change and keep, with its audit record and its caveats beside it.

  1. Download the Playground. It is free and runs on your own machine.
  2. Start a new app and tick “Text or email me when something breaks”.
  3. This block is written in, along with anything else you ticked.

Download the Playground See the other blocks

The mistake it removes

The naive version calls Twilio from the wrong place or lets a paging failure crash the very request it was trying to report. And a Twilio auth token in client code is a full-account credential leak.

What is already handled

Some are checked by running the block’s own tests every time its checks run and some only by reading the shipped source. Each item’s label says which. Tested means the block’s own test suite runs that code. It does not mean a live run against an outside service such as a payment provider.

What the audit found

Named rather than summarized. The reasoning behind each one ships inside the block, so it travels with the code instead of living on a page you have to trust. A finding marked fixed was fixed after the audit ran; the verdict above is still the one the audit gave.

One more finding is written in the auditors' internal shorthand, so it is not listed here. The full text is in the report inside the block. It was fixed after the audit, in 30bc5b88c.

What you still have to do

A copied file cannot own your secrets, your host or your legal obligations. This is the part the block deliberately does not claim.

What lands in your project

node

  • node/notify.js

createNotifier(config?) -> { sms, email, owner, smsConfigured, emailConfigured }. Also exports isCreditError(status, msg). Reads TWILIO_*/RESEND_* from env by default, or pass explicit config. Dependency-free (raw REST + fetch).

What you supply

Licensed MIT. It is a starting point, not a finished product.

Get it

Download the Playground See the other blocks

Nothing here is locked. The files are yours, in your folder, under a permissive license.

Questions

Is Alerts by text and email audited?
It was audited on 2026-09-29, and the verdict was not a clean pass. 4 findings have been fixed since then, and the verdict stands until the block is audited again.
What do I still have to do myself?
Keep this on the server and out of every client bundle. A Twilio auth token is a full-account credential; there is deliberately no vanilla build, but nothing stops a host importing the module into browser code.
How do I get this code?
Download the Playground, start a new app, and tick “Text or email me when something breaks”. The block is written into your project as ordinary source you can read and edit.

All pre-built code blocks · Learn to build from zero · The coding guide