SDK

Node / TypeScript

Official open-source client for Node.js 18+ and Bun. Full TypeScript types included.

Installation

npm install @linie/node
# or
bun add @linie/node

Initialisation

import { LinieClient } from "@linie/node";

const linie = new LinieClient({
  apiKey: process.env.LINIE_API_KEY,
});

Method reference

queues.create(options)

create(options: CreateQueueOptions): Promise<Queue>
Example
const queue = await linie.queues.create({
  ttl:                  600,
  heartbeat_interval:  60,
  priority_decay_rate: 0.1,
  reminder_at: [0.5, 0.8, 1.0],
});
Response
{ id: "q_abc123", ttl: 600, depth: 0, created_at: "2026-10-15T10:00:00Z" }

queues.enqueue(queueId, options)

enqueue(queueId: string, options: EnqueueOptions): Promise<Entry>
Example
const entry = await linie.queues.enqueue(queue.id, {
  priority: 100,
  metadata: { phone: "+6591234567", name: "Ahmad R." },
  idempotency_key: "usr_abc_20261015",
});
Response
{ id: "e_xyz789", position: 3, priority: 100, enqueued_at: "..." }

queues.next(queueId)

next(queueId: string): Promise<Entry | null>
Example
const head = await linie.queues.next(queue.id); // null if empty

queues.dequeue(queueId)

dequeue(queueId: string): Promise<Entry | null>
Example
const served = await linie.queues.dequeue(queue.id);

entries.heartbeat(queueId, entryId)

heartbeat(queueId: string, entryId: string): Promise<void>
Example
// Call from the customer's position page every heartbeat_interval seconds
await linie.entries.heartbeat(queue.id, entry.id);

Links

Changelog  ·  GitHub source — coming soon