Guides

Manage sources from code

Updated

A source is where a group of messages comes from, such as “GitHub Alerts” or “Backups”. Give each script its own, and you can tell messages apart at a glance and quiet one sender without touching the rest.

Every account starts with Inbox, which needs no setup. Create more in Ripple, or from code with an API token whose access is Everything, as this page shows. Listing them takes any level: Send only sees each source's name, and the other levels the sources they read.

Create a source

A new source needs only a name:

Terminal
curl https://api.ripple.do/v1/sources \
  -H "Authorization: Bearer $RIPPLE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "GitHub Alerts"}'

Ripple answers 201 Created with the new source and its sourceId. The same request can set any of its settings. To make a source that follows a status page, changelog, or project's releases, give feed instead of, or with, the name, as Feeds shows.

A name can be up to 64 characters, and each of your sources has its own: a name another source already has, ignoring capitals and repeated spaces, gets 409 source_name_taken, and so does renaming a source to one. “Inbox” is taken from the start. Names can change, but the ID never does, so keep the ID in your scripts.

Because names are unique, sending the same create twice can't make two sources: if a request times out, send it again, and a 409 source_name_taken means a source with that name exists. List your sources to find its ID.

Get its send key

Next, give your script a key that sends only to this source:

Terminal
curl -X POST https://api.ripple.do/v1/sources/src_06gh81f7x0xmzj8z/send-key \
  -H "Authorization: Bearer $RIPPLE_KEY"

The response has the key, a webhookUrl with the key in it for tools that only take a URL, and an emailAddress with the key in it for devices that only send email. Ask again and you get the same key.

If a key may have leaked, POST /v1/sources/{sourceId}/send-key/reset replaces it, and the old key, webhook URL, and email address stop working at once.

Tip

New source in Ripple opens the new source's page and asks only for its name, or a site to follow. Once you create it, the same page wakes with its settings and its ways to send, its key included, and waits there for its first message.

How many you can have

An account can keep up to 100 sources, counting any in Trash, and make up to 30 attempts a minute to create one. Every attempt counts, including one turned away because its name is taken, and so does each feed lookup. Inbox counts toward neither. Past those limits, Ripple answers 409 source_limit_reached or 429 source_creation_rate_limited. Deleting a source for good frees its place.

Find your sources

List every source with its settings and counts:

Terminal
curl https://api.ripple.do/v1/sources \
  -H "Authorization: Bearer $RIPPLE_KEY"

Inbox comes first, then the rest from oldest to newest, all on one page. Inbox's kind is system; every source you make is custom. Use Inbox's sourceId when a list or search should show only Inbox's messages. In Ripple, any source's menu has Copy source ID.

Each source also reports how it's doing:

FieldWhat it counts
unreadCountUnread messages, not counting archived or snoozed ones. A thread counts once.
importantUnreadCountHow many of those are Important
quietUnreadCountHow many of those are Quiet
snoozedCountIts messages waiting in Snoozed
lastMessageAtWhen it last accepted a message, or null if it never has. A good way to spot a script that has gone silent.
feedThe feed it follows, with when Ripple last read it and any problem, or null

To read one source, use GET /v1/sources/{sourceId}.

Change a source's settings

Send only what you want to change in a PATCH. Everything else stays as it is:

Terminal
curl -X PATCH https://api.ripple.do/v1/sources/src_06gh81f7x0xmzj8z \
  -H "Authorization: Bearer $RIPPLE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Builds", "defaultAlert": "quiet"}'

To clear a setting, send it as null, or defaultLinks as []. emailThreads is never cleared, only set to true or false. feed is an address on the way in, and comes back as the feed Ripple found.

SettingWhat it does
nameThe source's name, unique among your sources
iconSymbolThe name of an icon from the app's icon picker, such as rocket, or a brand's logo, such as brand:github
iconColorThe icon's color
imageUrlAn https:// image to show instead of an icon
defaultAlertThe alert for messages that don't choose one
defaultSoundThe sound for messages that don't choose one
defaultLinksUp to 4 links for messages sent without links
emailThreadsWhether emails with the same subject join one thread; true unless you turn it off
feedThe address of a feed to follow, or of a page that names one; null stops following
  • A source shows an icon or an image, not both. To switch, clear the one it has.
  • A new source without an image gets the icon its name suggests, so Nightly backup gets backup and GitHub deploys gets brand:github, unless you choose one. A brand named with an everyday word gets its logo only when the rest of the name is words like alerts or updates: Stripe alerts gets brand:stripe, but Shell scripts gets terminal. null shows a letter tile instead.
  • Brand logos come from Simple Icons: brand: followed by the brand's slug there. A few brands, such as Slack and Microsoft, aren't available, and asking for one returns 400 invalid_source; upload their image instead.
  • The colors are red, orange, yellow, green, teal, blue, indigo, purple, and pink. A new source without an image gets one of your least-used colors unless you choose one, or the color nearest its brand's for a logo, and null keeps the neutral tile.
  • An image uploaded in the app brings its own color: iconColor becomes the one nearest the image's, or null for a black-and-white image, and stays when you remove the image. A source can't take another color while it shows an image, and a linked https:// image has none.
  • The sounds are the ones a message can choose, listed in Send messages. A defaultSound of null plays the account's sound. With sounds turned off in Ripple's settings, every source stays silent.
  • Inbox takes icon, color, image, and default changes, but keeps its name and can't follow a feed.

A Ripple source can hold up to 4 default links, so every message from a script that sends none opens its dashboard, logs, or runbook:

Terminal
curl -X PATCH https://api.ripple.do/v1/sources/src_06gh81f7x0xmzj8z \
  -H "Authorization: Bearer $RIPPLE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"defaultLinks": [{"url": "https://ci.example.com/builds", "title": "Builds"}, "https://status.example.com"]}'

Each default link takes the same shape as a message's links: a link, or an object with its url and a title of up to 64 characters. An http:// link is kept as https://, and a blank one, as an empty form field sends, is skipped and doesn't count toward the 4; a list holds up to 20 entries. A link Ripple can't open, one listed twice, or a fifth gets 400 invalid_source, and nothing changes. Ripple answers with each link as an object with its url and title, and title is null where you gave none.

A send that leaves out links, or keeps none of the ones it lists, gets all of the source's default links, in order. Otherwise it gets only its own, and "links": [] sends none. A new list replaces the old one, and [] removes them all.

Quiet a source

When a script gets noisy, set its source's default alert to quiet:

Terminal
curl -X PATCH https://api.ripple.do/v1/sources/src_06gh81f7x0xmzj8z \
  -H "Authorization: Bearer $RIPPLE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"defaultAlert": "quiet"}'

Ripple keeps saving its messages as Quiet, so they don't notify or come to Home, unless a send asks for standard or important. To have them notify again, send "defaultAlert": null.

Disable or mark read

To stop a Ripple source taking messages for a while, or catch up on it at once, post to one of these addresses with no body:

AddressDoes
/v1/sources/{sourceId}/disableStops it accepting messages; sends get 403 source_disabled. /enable lets them in again.
/v1/sources/{sourceId}/readMarks all its messages read

Home leaves out a disabled source's messages. Inbox can't be disabled.

Remove a source

To move a source to Trash, send a DELETE with no body:

Terminal
curl -X DELETE https://api.ripple.do/v1/sources/src_06gh81f7x0xmzj8z \
  -H "Authorization: Bearer $RIPPLE_KEY"

Its messages stay where they are. To move them to Trash with it, add ?deleteMessages=true. Inbox can't be removed.

The source stays in Trash for 30 days, and you can restore it until then. If another source has taken its name meanwhile, it comes back numbered, such as “Builds 2”. The response's deletedAt lets a later restore or permanent deletion act only on this removal.

The API reference has every source operation in full.