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

@kirimdev/sdk

v3.14.0

Published

Official TypeScript SDK for the Kirimdev Public API.

Downloads

1,579

Readme

@kirimdev/sdk

Official TypeScript SDK for the Kirimdev Public API.

Install

npm install @kirimdev/sdk
# or
bun add @kirimdev/sdk

Quickstart

import { Kirim } from '@kirimdev/sdk'

const kirim = new Kirim({ apiKey: process.env.KIRIM_API_KEY! })

// Scope to a WhatsApp phone number (Meta `business_phone_number_id`).
// Look it up via `kirim.accounts.list()` if you don't have it handy.
const phone = kirim.phoneNumbers('106540352242922')

// Send a message
const msg = await phone.messages.send({
  messaging_product: 'whatsapp',
  to: '628123456789',
  type: 'text',
  text: { body: 'Halo dari SDK!' },
})

// Paginate
for await (const m of phone.messages.list({ limit: 50 })) {
  console.log(m.id, m.status)
}

Webhook verification

verifyWebhookSignature parses the X-Kirim-Signature header (Stripe-style t=<unix>,v1=<hex> format), checks the timestamp against a tolerance window, verifies the HMAC-SHA256 against one or more active secrets (supports rotation), and returns the parsed JSON body. It throws on every failure mode — never returns false. Uses Web Crypto so it runs unchanged on Node 18+, Bun, Deno, and edge runtimes.

import { verifyWebhookSignature, InvalidSignatureError } from '@kirimdev/sdk/webhooks'

export async function POST(req: Request) {
  const rawBody = await req.text()
  try {
    const event = await verifyWebhookSignature({
      rawBody,
      signatureHeader: req.headers.get('x-kirim-signature'),
      secrets: [process.env.KIRIM_WEBHOOK_SECRET!],
    })
    // event is KirimWebhookEvent — narrow on event.type or event.object
    return new Response('ok')
  } catch (err) {
    if (err instanceof InvalidSignatureError) return new Response('bad sig', { status: 401 })
    throw err
  }
}

Errors thrown (all extend KirimWebhookError):

  • InvalidSignatureError — header missing/malformed, or no v1= matched any provided secret
  • SignatureExpiredError|now - t| exceeds toleranceSeconds (default 300s)
  • MalformedPayloadError — signature matched but body is not valid JSON

Features

  • Full coverage of the Kirimdev /v1 API (~35 endpoints)
  • Type-safe — generated from the live OpenAPI 3.1 spec
  • Automatic retries with exponential backoff (429, 5xx, network errors)
  • Automatic Idempotency-Key injection for POST requests
  • Async iterator pagination (for await ... of kirim.messages.list(...))
  • Typed error class hierarchy keyed off stable API error codes
  • Webhook HMAC-SHA256 verifier
  • Zero Node-specific dependencies — works in Node 18+, Bun, Deno

Configuration

new Kirim({
  apiKey: 'kdv_live_...',                    // required
  baseUrl: 'https://api.kirimdev.com/v1', // optional
  timeout: 30_000,                            // ms, default 30s
  maxRetries: 2,                              // default 2
  fetch: globalThis.fetch,                    // injectable for testing
})

License

MIT