Star
API reference

TypeScript client

NotifkitClient is a thin, typed wrapper over the REST API. Each method makes one request and returns the response body.

Setup

import { NotifkitClient } from "notifkit";

const notifkit = new NotifkitClient({
  baseUrl: "https://notify.example.com",
  apiKey: process.env.NOTIFKIT_API_KEY,   // sent as Authorization: Bearer
  headers: { "x-project-id": "…" },       // optional, added to every request
  templates: [/* … */],                   // optional, pushed by sync()
});

With the admin key, set x-project-id in headers for project routes. A 204 resolves to undefined. Any other non-2xx throws an Error whose message is the body's message, else its error, else Request failed with status <code>. Validation errors therefore surface as "validation_error": read the issues with a direct request if you need them. There's no built-in retry.

Methods

MethodRequest
notify(input)POST /v1/notify
getNotificationStatus(taskId)GET /v1/notifications/:taskId
cancelNotification(taskId)DELETE /v1/notifications/:taskId
getScheduledMessages()GET /v1/notifications/scheduled
getNotificationLogs(options?)GET /v1/notifications/logs
addUser(input) / identify(input)POST /v1/users
listUsers(options?)GET /v1/users
getUser(id)GET /v1/users/:id
getUserDetails(id)GET /v1/users/:id/details
updateUser(id, patch)PATCH /v1/users/:id
deleteUser(id)DELETE /v1/users/:id
addContact(userId, contact)POST /v1/users/:id/contacts
addContacts(userId, contacts)POST /v1/users/:id/contacts
getUserContacts(userId)GET /v1/users/:id/contacts
deleteContact(userId, channel, target)DELETE /v1/users/:id/contacts/:channel/:target
getUserPreferences(id)GET /v1/users/:id/preferences
updateUserPreferences(id, prefs)PATCH /v1/users/:id/preferences
listSegments()GET /v1/segments
syncTemplates(templates)PUT /v1/templates
sync()PUT /v1/templates
listTemplates()GET /v1/templates
getTemplate(id)GET /v1/templates/:id
deleteTemplate(id)DELETE /v1/templates/:id
createWorkflow(input)POST /v1/workflows
listWorkflows(options?)GET /v1/workflows
triggerWorkflow(input)POST /v1/workflows/trigger
getWorkflow(instanceId)GET /v1/workflows/instances/:id
cancelWorkflow(instanceId)DELETE /v1/workflows/instances/:id
ingestEvent(input)POST /v1/events
listCampaigns(options?)GET /v1/campaigns
getCampaignStats(campaign)GET /v1/campaigns/:campaign/stats
listSuppressions(options?)GET /v1/suppressions
createSuppression(input)POST /v1/suppressions
deleteSuppression(channel, target)DELETE /v1/suppressions/:channel/:target
getSystemHealth()GET /v1/system/health
getSystemMetrics()GET /v1/system/metrics
getDLQMessages()GET /v1/dlq
replayDLQMessage(id)POST /v1/dlq/replay
deleteDLQMessage(id)DELETE /v1/dlq/:id
listProjects()GET /v1/projects
updateProject(id, input)PATCH /v1/projects/:id
deleteProject(id)DELETE /v1/projects/:id
createProjectKey(id, { role })POST /v1/projects/:id/keys
listProjectKeys(id)GET /v1/projects/:id/keys
deleteProjectKey(id, keyId)DELETE /v1/projects/:id/keys/:keyId