Recipes

Short Tinyping examples for a new sign-up, a payment, an error spike, a failed backup and a finished deploy.

Each recipe assumes TINYPING_TOKEN is set. Every JavaScript recipe uses this notify helper. See Sending events for all the fields.

JavaScript
export async function notify(event) {
  try {
    const response = await fetch('https://api.tinyping.app/v1/events', {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.TINYPING_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify(event),
      signal: AbortSignal.timeout(5000),
    });
    return response.ok;
  } catch {
    return false;
  }
}

New sign-up

Send an alert from the code that creates the account.

JavaScript
await notify({ title: 'New sign-up', body: user.email, kind: 'signup' });

Payment received

Send a short summary, not the full payload. Verify your payment provider signature before this step.

JavaScript
await notify({
  title: 'Payment received',
  body: `${customer.email} paid ${amount}`,
  kind: 'payment',
  url: invoiceUrl,
});

Error spike

Use high priority so the event stands out in your inbox.

JavaScript
await notify({
  title: 'Error spike',
  body: `${count} errors in the last 5 minutes`,
  kind: 'error',
  priority: 'high',
  tags: ['api'],
});

Failed backup

The || runs curl only when the backup command fails.

Shell
./backup.sh || curl https://api.tinyping.app/v1/events \
  -H "Authorization: Bearer $TINYPING_TOKEN" \
  -d title="Backup failed" \
  -d kind=backup \
  -d priority=high

Deploy finished

Use low priority for good news you only need to see later.

Python
import json, os, urllib.request

event = {"title": "Deploy finished", "body": "main is live", "kind": "deploy", "priority": "low"}
request = urllib.request.Request(
    "https://api.tinyping.app/v1/events",
    data=json.dumps(event).encode(),
    headers={
        "Authorization": f"Bearer {os.environ['TINYPING_TOKEN']}",
        "Content-Type": "application/json",
    },
)
urllib.request.urlopen(request, timeout=5).close()
Tip

Use the kind field for the type of event. You can then search for it in your inbox.

Know about your next sign-up the second it happens

Create a free project, paste the prompt into your AI agent and get your first push in minutes.