Skip to content

Getting Started

Here’s how to start sending Web Push notifications with todoke.

todoke offers three ways to use it depending on your needs.

MethodShortest pathDetails page
DashboardSign up and log in from your browser, then create apps / check subscription status / view statistics from the UIAccount registration and login
CLItodoke logintodoke notifyCLI
API / SDKIssue an API key and call POST /api/v1/notify (covered on this page)This page / TypeScript SDK

The shortest CLI path is as follows (assuming you are already logged in with a full scope key).

Terminal window
todoke login --api-key pk_full_key
todoke notify <app-id> -t "Test notification" -b "Sent successfully!"
# Note: <app-id> is not referenced in the current implementation; the destination is
# determined by the app associated with the logged-in key

The quick start below covers the dashboard and API / SDK workflows.

  1. Create an account

    Visit the todoke dashboard and sign up with your email and password, or log in with your GitHub account.

  2. Create an app

    Click “Create New App” in the dashboard and enter an app name. A VAPID public key will be automatically generated.

  3. Issue an API key

    Create a key in the “API Keys” section of the app detail screen. Choose a scope that matches your use case.

    • subscribe_only — For embedding in the frontend (subscription registration only)
    • notify — For sending notifications from the server side
    • full — Management key that allows all operations
  4. Implement subscription registration in the frontend

    Use the VAPID public key and subscribe_only key to register subscriptions from the browser.

    import { PushCF } from "@todoke/sdk";
    const client = new PushCF({
    apiKey: "pk_subscribe_only_key",
    });
    const registration = await navigator.serviceWorker.ready;
    await client.subscribe({ registration }); // Register Push subscription
  5. Send a notification

    Send a notification from the server side using a notify scope key.

    Terminal window
    curl -X POST https://api.todoke.dev/api/v1/notify \
    -H "Authorization: Bearer pk_notify_key" \
    -H "Content-Type: application/json" \
    -d '{"title":"Test Notification","body":"Sent successfully!"}'