Node.js SDK

The @helmdesk/sdk package provides a fully typed client for all API endpoints. It uses native fetch and works in Node.js 18+, Deno, Bun, and Cloudflare Workers.

Installation

npm install @helmdesk/sdk

Initialize

import { HelmdeskClient, HelmdeskError } from '@helmdesk/sdk'

const client = new HelmdeskClient({
  apiKey: 'sk_live_...',
  baseUrl: 'https://helmdesk.dev', // optional, defaults to production
})

Available resources

ResourceMethods
client.ticketscreate, list, get, update, addMessage
client.emailssend, preview, getTemplateSchema
client.emails.templatesimport
client.articlessearch

Error handling

All API errors throw a HelmdeskError with typed properties:

import { HelmdeskError } from '@helmdesk/sdk'

try {
  await client.tickets.get('invalid-id')
} catch (err) {
  if (err instanceof HelmdeskError) {
    console.log(err.status) // 404
    console.log(err.code)   // "not_found"
    console.log(err.message) // "Ticket not found"
  }
}

See Error Handling for the full list of error codes.