brrr
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data β all from the browser, and deployed in milliseconds.
A Val Town library for sending push notifications via brrr.now.
- Install the brrr app on your iPhone/iPad
- Copy your webhook secret from the app (looks like
br_usr_a1b2c3...) - Add it as an environment variable called
BRRR_SECRETin your val
import { Brrr, send } from "https://esm.town/v/nbbaier/brrr/main.ts";
// One-liner β reads BRRR_SECRET from env
await send("Hello world! π");
// With options
await send({
title: "Deploy Complete",
message: "v1.2.0 shipped to production",
sound: "cha_ching",
open_url: "https://example.com/releases",
});
// Class-based β reuse for multiple notifications
const brrr = new Brrr();
await brrr.send("First notification");
await brrr.send({ title: "Second", message: "With a title" });
// Bare secret
const brrr = new Brrr("br_usr_a1b2c3d4e5f6g7h8i9j0");
// Full webhook URL
const brrr = new Brrr("https://api.brrr.now/v1/br_usr_a1b2c3d4e5f6g7h8i9j0");
// Config object
const brrr = new Brrr({ secret: Deno.env.get("MY_CUSTOM_SECRET")! });
// One-liner with explicit secret
await send("Hello!", "br_usr_a1b2c3d4e5f6g7h8i9j0");
Create a client. config can be:
- omitted β reads
BRRR_SECRETfrom environment - a string β treated as the secret (bare
br_usr_...or full URL) - an object β
{ secret: "br_usr_..." }
Send a push notification. notification can be:
- a string β sent as plain text message body
- a
BrrrOptionsobject β full control over title, sound, etc.
Returns the raw Response from the brrr API.
Standalone function β creates a client and sends in one call.
| Field | Type | Description |
|---|---|---|
title | string | First line of the notification |
subtitle | string | Line under the title |
message | string | Primary content |
thread_id | string | Group related notifications together |
sound | BrrrSound | Notification sound (see below) |
open_url | string | Link to open on tap |
image_url | string | Image displayed in the notification |
expiration_date | string | ISO 8601 date for APNS retry deadline |
filter_criteria | string | Match a Focus filter on the device |
interruption_level | "passive" | "active" | "time-sensitive" | How the notification interrupts |
default, system, brrr, bell_ringing, bubble_ding,
bubbly_success_ding, cat_meow, calm1, calm2, cha_ching, dog_barking,
door_bell, duck_quack, short_triple_blink, upbeat_bells,
warm_soft_error