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

@kirimchat/sdk

v1.0.1

Published

TypeScript SDK for KirimChat Public API

Readme

@kirimchat/sdk

TypeScript SDK for KirimChat Public API - Send messages via WhatsApp, Instagram, and Messenger.

npm version License: MIT

Features

✅ Full TypeScript support with auto-generated types
✅ WhatsApp, Instagram, and Messenger messaging
✅ Template messages with variables
✅ Interactive messages (buttons, lists)
✅ Customer management
✅ Native fetch API (Node.js 18+, browser)
✅ ESM + CJS dual build

Installation

npm install @kirimchat/sdk
# or
pnpm add @kirimchat/sdk
# or
yarn add @kirimchat/sdk

Requirements

  • Node.js >= 18.0.0 (for native fetch support)
  • KirimChat API key (get it from dashboard)

Quick Start

import { sendMessage, client } from '@kirimchat/sdk'

// Configure SDK
client.setConfig({
  baseUrl: 'https://api-prod.kirim.chat/api/v1/public',
  headers: {
    Authorization: 'Bearer kc_live_your_api_key_here'
  }
})

// Send a WhatsApp message
const result = await sendMessage({
  body: {
    phone_number: '628123456789',
    channel: 'whatsapp',
    message_type: 'text',
    content: 'Hello from KirimChat SDK!'
  }
})

console.log('Message sent:', result)

Usage

Configuration

import { client } from '@kirimchat/sdk'

client.setConfig({
  baseUrl: 'https://api-prod.kirim.chat/api/v1/public',
  headers: {
    Authorization: 'Bearer kc_live_your_api_key_here',
    'X-Custom-Header': 'value' // Optional: additional headers
  }
})

Customer Management

import { createCustomer, getCustomerById, getCustomerByPhone, listCustomers } from '@kirimchat/sdk'

// Create a customer
const customer = await createCustomer({
  body: {
    phone_number: '628123456789',
    name: 'John Doe',
    consent_status: true,
    tags: ['lead', 'website']
  }
})

// Get customer by ID
const customerById = await getCustomerById({
  path: { customerId: 'clxxx1234567890' }
})

// Get customer by phone number
const customerByPhone = await getCustomerByPhone({
  path: { phoneNumber: '628123456789' }
})

// List customers with filters
const customers = await listCustomers({
  query: {
    page: 1,
    limit: 20,
    consent_status: 'true',
    search: 'John',
    sort_by: 'created_at',
    sort_order: 'desc'
  }
})

Sending Messages

Text Message

import { sendMessage } from '@kirimchat/sdk'

await sendMessage({
  body: {
    phone_number: '628123456789',
    channel: 'whatsapp',
    message_type: 'text',
    content: 'Hello, how can I help you?'
  }
})

Media Message

await sendMessage({
  body: {
    phone_number: '628123456789',
    channel: 'whatsapp',
    message_type: 'image',
    media_url: 'https://example.com/image.jpg',
    caption: 'Check out our latest product!'
  }
})

Interactive Message (Buttons)

await sendMessage({
  body: {
    phone_number: '628123456789',
    channel: 'whatsapp',
    message_type: 'interactive',
    interactive: {
      type: 'button',
      body: { text: 'How would you rate our service?' },
      action: {
        buttons: [
          { type: 'reply', reply: { id: 'good', title: 'Good' } },
          { type: 'reply', reply: { id: 'ok', title: 'Okay' } },
          { type: 'reply', reply: { id: 'bad', title: 'Bad' } }
        ]
      }
    }
  }
})

Interactive Message (List)

await sendMessage({
  body: {
    phone_number: '628123456789',
    channel: 'whatsapp',
    message_type: 'interactive',
    interactive: {
      type: 'list',
      body: { text: 'Please select a service' },
      action: {
        button: 'View Menu',
        sections: [
          {
            title: 'Services',
            rows: [
              { id: 'haircut', title: 'Haircut', description: 'Basic haircut' },
              { id: 'coloring', title: 'Hair Coloring', description: 'Full color' }
            ]
          }
        ]
      }
    }
  }
})

Template Message

await sendMessage({
  body: {
    phone_number: '628123456789',
    channel: 'whatsapp',
    message_type: 'template',
    template: {
      name: 'order_confirmation',
      language: { code: 'id' },
      components: [
        {
          type: 'body',
          parameters: [
            { type: 'text', text: 'John Doe' },
            { type: 'text', text: 'INV-12345' }
          ]
        }
      ]
    }
  }
})

Message Status

import { getMessageStatus, markMessageAsRead } from '@kirimchat/sdk'

// Get message status
const status = await getMessageStatus({
  path: { messageId: 'msg_xyz789' }
})

// Mark message as read
await markMessageAsRead({
  path: { messageId: 'msg_xyz789' }
})

Typing Indicator

import { sendTypingIndicator } from '@kirimchat/sdk'

// Send typing indicator
await sendTypingIndicator({
  path: { customerIdentifier: '628123456789' },
  body: {
    channel: 'whatsapp'
  }
})

Templates

import { listTemplates, getTemplate } from '@kirimchat/sdk'

// List templates
const templates = await listTemplates({
  query: {
    status: 'APPROVED',
    category: 'MARKETING',
    limit: 100
  }
})

// Get specific template
const template = await getTemplate({
  path: { templateId: 'tmpl_xyz789' }
})

Connected Accounts

import { listInstagramAccounts, listMessengerPages } from '@kirimchat/sdk'

// List Instagram accounts
const igAccounts = await listInstagramAccounts()

// List Facebook Pages (Messenger)
const fbPages = await listMessengerPages()

Error Handling

import { sendMessage } from '@kirimchat/sdk'

try {
  await sendMessage({
    body: {
      phone_number: '628123456789',
      channel: 'whatsapp',
      message_type: 'text',
      content: 'Hello!'
    }
  })
} catch (error) {
  console.error('API Error:', error)
}

Examples

See the examples directory for more usage examples:

API Reference

Full API documentation: https://docs.kirim.chat

Development

# Install dependencies
pnpm install

# Generate SDK from OpenAPI spec
pnpm generate

# Type check
pnpm typecheck

# Build
pnpm build

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

MIT © KirimChat

Support

  • Documentation: https://docs.kirim.chat
  • Email: [email protected]
  • Website: https://kirim.chat