Tools

Send from JavaScript or Python

Updated

Ripple is plain HTTP and JSON, so any language can call it with what it already has. There's no SDK to install. Start from a send in JavaScript or Python.

Both read a send key from the RIPPLE_KEY environment variable, which keeps the key out of your code.

JavaScript

Runs in Node 22 or newer, with no packages:

JavaScript
const response = await fetch("https://api.ripple.do/v1/send", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.RIPPLE_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ title: "Backup finished", body: "All 12 databases are saved." }),
  signal: AbortSignal.timeout(30_000),
});
if (!response.ok) throw new Error(`Ripple returned HTTP ${response.status}`);
console.log(await response.json());

Python

Uses only the standard library:

Python
import json
import os
import urllib.request

request = urllib.request.Request(
    "https://api.ripple.do/v1/send",
    data=json.dumps({"title": "Backup finished", "body": "All 12 databases are saved."}).encode(),
    headers={
        "Authorization": "Bearer " + os.environ["RIPPLE_KEY"],
        "Content-Type": "application/json",
    },
    method="POST",
)
with urllib.request.urlopen(request, timeout=30) as response:
    print(json.load(response))
Result

Either one prints Ripple's receipt, with the new message's messageId, and “Backup finished” arrives in the key's source.

Send messages shows everything else a message can carry.

Everything else

Reading, searching, and organizing work the same way with a different address and body. Put an API token in RIPPLE_KEY instead of a send key.

Every operation in the API reference has curl, JavaScript, and Python to copy. Any other language follows the same pattern: your key in the Authorization header and, where there's a body, JSON.

Warning

Keep keys in server-side code and scripts. Anyone who opens a web page or browser app can read a key placed in it.