Zeph Docs
CLI & SDK

SDK

Send pushes from your own code with the ZephHook client.

ZephHook is the programmatic half of @zeph-to/cli. It uses native fetch and has no runtime dependencies.

import { ZephHook } from '@zeph-to/cli';

const hook = new ZephHook({ apiKey: 'ak_...' });

// Notify
const result = await hook.notify({
  title: 'Build Complete',
  body: 'Deploy succeeded',
  url: 'https://example.com/deploy/123',
  priority: 'high',
});
console.log(result.pushId); // 'push_01JXY...'

// List
const list = await hook.list({ limit: 5 });
console.log(list.pushes);

// Dismiss
await hook.dismiss('push_01JXY...');
await hook.dismissAll();

Constructor options

FieldTypeDescription
apiKeystringRequired. API key from Zeph settings
baseUrlstring?API base URL (default: https://api.zeph.to/v1)
timeoutnumber?Request timeout in milliseconds (default: 30000)

Notify payload

FieldTypeDescription
titlestring?Push title
bodystring?Push body
urlstring?URL to include
type'note' | 'link' | 'file' | 'hook'?Push type (default: hook)
priority'low' | 'normal' | 'high' | 'urgent'?Priority (default: normal)
targetDeviceIdstring?Send to a specific device

Error handling

import { ZephHook, AuthenticationError, QuotaExceededError, ZephError } from '@zeph-to/cli';

try {
  await hook.notify({ title: 'Hello' });
} catch (err) {
  if (err instanceof AuthenticationError) { /* Invalid API key */ }
  if (err instanceof QuotaExceededError) { /* Monthly limit reached */ }
  if (err instanceof ZephError) { /* Other API error */ }
}

On this page