Node.js SDK
TypeScript-friendly client for Node.js APIs and serverless functions.
Install
npm install @commspliant/node-sdkLinks
Quickstart
Render an approved template to HTML:
import { writeFile } from "node:fs/promises";
import { CommsPliantClient } from "@commspliant/node-sdk";
const client = new CommsPliantClient("ck_YOUR_API_KEY");
const result = await client.renderHtml({
templateId: "550e8400-e29b-41d4-a716-446655440000",
variables: {
title: "Monthly Report",
user: { name: "Jane Doe" },
},
});
await writeFile("document.html", result.body);API endpoints
The SDK supports both Customer Integration API render endpoints:
- POST /api/v1/render/html— render template to HTML
- POST /api/v1/render/pdf— render template to PDF
Use renderHtml / renderPdf (or language-specific naming) on the client. See the GitHub repository for full documentation and PDF examples.