Zeph Docs
CLI & SDK

SDK

ZephHook 클라이언트로 직접 짠 코드에서 푸시를 보낸다.

ZephHook@zeph-to/cli의 프로그래밍 인터페이스다. 네이티브 fetch를 쓰고 런타임 의존성이 없다.

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

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

// 알림
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...'

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

// 해제
await hook.dismiss('push_01JXY...');
await hook.dismissAll();

생성자 옵션

필드타입설명
apiKeystring필수. Zeph 설정에서 발급한 API 키
baseUrlstring?API 기본 URL (기본값: https://api.zeph.to/v1)
timeoutnumber?요청 타임아웃, 밀리초 (기본값: 30000)

notify 페이로드

필드타입설명
titlestring?푸시 제목
bodystring?푸시 본문
urlstring?포함할 URL
type'note' | 'link' | 'file' | 'hook'?푸시 유형 (기본값: hook)
priority'low' | 'normal' | 'high' | 'urgent'?우선순위 (기본값: normal)
targetDeviceIdstring?특정 디바이스로 전송

에러 처리

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

try {
  await hook.notify({ title: 'Hello' });
} catch (err) {
  if (err instanceof AuthenticationError) { /* API 키가 잘못됨 */ }
  if (err instanceof QuotaExceededError) { /* 월 한도 초과 */ }
  if (err instanceof ZephError) { /* 그 외 API 오류 */ }
}

이 페이지에서