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/sdkInitialize
import { HelmdeskClient, HelmdeskError } from '@helmdesk/sdk'
const client = new HelmdeskClient({
apiKey: 'sk_live_...',
baseUrl: 'https://helmdesk.dev', // optional, defaults to production
})Available resources
| Resource | Methods |
|---|---|
client.tickets | create, list, get, update, addMessage |
client.emails | send, preview, getTemplateSchema |
client.emails.templates | import |
client.articles | search |
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.