npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

zammad-typescript-api

v1.0.0

Published

TypeScript wrapper client for the Zammad REST API

Readme

Zammad TypeScript API Client

A TypeScript wrapper client for the Zammad REST API, providing a clean and type-safe interface for managing tickets and other Zammad resources.

Features

  • 🚀 TypeScript First: Built with TypeScript for better developer experience
  • 🔐 Secure Authentication: Token-based authentication with environment variables
  • 📦 Zero Dependencies: Only depends on axios for HTTP requests
  • 🎯 Simple API: Clean and intuitive methods for common operations
  • 🔄 Async/Await: Modern JavaScript with full async support

Installation

npm install zammad-typescript-api

Quick Start

1. Set Environment Variables

export ZAMMAD_HOST="https://your-zammad-instance.com"
export ZAMMAD_ACCESS_TOKEN="your_access_token_here"

2. Basic Usage

import getZammadClient from 'zammad-typescript-api';

// Get the client instance
const zammad = getZammadClient();

// Create a new ticket
const newTicket = await zammad.createTicket({
  title: 'Support Request',
  group: 'Users',
  customer_id: 1,
  article: {
    body: 'I need help with my account',
    type: 'web',
    internal: false
  }
});

// Get all tickets
const tickets = await zammad.getTickets();

// Get a specific ticket
const ticket = await zammad.getTicket(123);

// Update a ticket
await zammad.updateTicket(123, {
  title: 'Updated Support Request'
});

// Delete a ticket
await zammad.deleteTicket(123);

API Reference

ZammadHTTPClient

The main client class for interacting with the Zammad API.

Constructor

The client automatically reads configuration from environment variables:

  • ZAMMAD_HOST: Your Zammad instance URL
  • ZAMMAD_ACCESS_TOKEN: Your API access token

Methods

createTicket(ticketData: any)

Creates a new ticket in Zammad.

Parameters:

  • ticketData: Object containing ticket information (title, group, customer_id, article, etc.)

Returns: Promise with the created ticket data

getTickets(params?: any)

Retrieves a list of tickets.

Parameters:

  • params (optional): Query parameters for filtering tickets

Returns: Promise with array of tickets

getTicket(id: number)

Retrieves a specific ticket by ID.

Parameters:

  • id: The ticket ID

Returns: Promise with ticket data

updateTicket(id: number, ticketData: any)

Updates an existing ticket.

Parameters:

  • id: The ticket ID
  • ticketData: Object containing updated ticket information

Returns: Promise with updated ticket data

deleteTicket(id: number)

Deletes a ticket.

Parameters:

  • id: The ticket ID

Returns: Promise with deletion result

Environment Variables

| Variable | Description | Required | |----------|-------------|----------| | ZAMMAD_HOST | Your Zammad instance URL (e.g., https://help.yourcompany.com) | Yes | | ZAMMAD_ACCESS_TOKEN | Your Zammad API access token | Yes |

Error Handling

The client includes comprehensive error handling and will throw errors with detailed information when API calls fail. Errors include:

  • Missing environment variables
  • Authentication failures
  • API request failures
  • Network errors

Development

Prerequisites

  • Node.js 16+
  • npm or yarn

Setup

# Clone the repository
git clone https://github.com/yourusername/zammad-typescript-api.git
cd zammad-typescript-api

# Install dependencies
npm install

# Build the project
npm run build

# Run tests
npm test

Scripts

  • npm run build - Compiles TypeScript to JavaScript
  • npm run test - Runs TypeScript type checking
  • npm run clean - Removes the dist folder
  • npm run prepare - Automatically runs build before npm publish

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

MIT License - see LICENSE file for details.

Support

If you encounter any issues or have questions:

  1. Check the issues page
  2. Create a new issue with detailed information
  3. Include your Zammad version and Node.js version

Changelog

1.0.0

  • Initial release
  • Basic ticket CRUD operations
  • TypeScript support
  • Environment variable configuration