HospifyDashboard
Docs menu

Server (Node.js)

@hospify/org-sdk/server runs on Node 18+, Deno, Bun and edge runtimes. Any other language: call the API directly; it's plain JSON over HTTPS.

npm
npm install @hospify/org-sdk
TypeScript
import { HospifyServer, HospifyError, verifyWebhook } from "@hospify/org-sdk/server";

const hospify = new HospifyServer({ secretKey: process.env.HOSPIFY_SECRET_KEY! });   // hsk_test_... / hsk_live_...

// Agents
await hospify.agents.upsert("AGT-20931", { display_name: "Field agent, Ikeja", team: "Ikeja" });
await hospify.agents.batch([{ external_id: "AGT-2", display_name: "Agent Yaba" }]);
for await (const a of hospify.allAgents()) console.log(a.external_id);
await hospify.agents.remove("AGT-2");

// The app's session token
const { token } = await hospify.sessions.create("AGT-20931");

// Your control room
const open = await hospify.incidents.list({ status: "open" });
await hospify.incidents.acknowledge(open.data[0].id, { by: "Control room" });
await hospify.incidents.resolve(open.data[0].id, { outcome: "resolved", note: "Agent safe" });

// Events
const { data: events } = await hospify.events.list({ after: lastEventId });

// Webhooks
const event = await verifyWebhook(rawBody, signatureHeader, process.env.HOSPIFY_WEBHOOK_SECRET!);

// Account and KYB
const account = await hospify.account();   // { livemode, kyb, live_allowed, ... }

Every failure is a HospifyError with code, message and status.