Node SDK
BetaUse the official Getme Node SDK for TypeScript and JavaScript integrations.
Getme Node is the official JavaScript and TypeScript client for Getme developer APIs.
Installation
npm install @getme-tech/getme-node
Node.js 20 or newer is required.
Source code: github.com/getme-tech/getme-node
Quick start
import {GetmeClient} from "@getme-tech/getme-node";
const getme = new GetmeClient({
apiKey: process.env.GETME_API_KEY,
});
const sites = await getme.sites.list();
const products = await getme.products.list({limit: 10});
console.log(sites.data.map((site) => site.name));
console.log(products.data.map((product) => product.name));
GETME_API_KEY should contain an app-install access token such as gmat_test_... or gmat_live_....
Pagination
List endpoints use cursor pagination:
const firstPage = await getme.sites.list({limit: 25});
const lastSite = firstPage.data.at(-1);
if (firstPage.has_more && lastSite) {
const nextPage = await getme.sites.list({
limit: 25,
cursor: lastSite.id,
});
console.log(nextPage.data.length);
}
For full scans, use auto-paging:
for await (const site of getme.sites.listAutoPaging({limit: 100})) {
console.log(site.id, site.name);
}
for await (const product of getme.products.listAutoPaging({limit: 100})) {
console.log(product.id, product.name);
}
The SDK sends cursor as starting_after. Pagination primitives are shared by resources so future list endpoints use the same behavior.
Commerce catalog
const product = await getme.products.create({
name: "Coffee",
sku: "COF-001",
status: "draft",
});
await getme.products.update(product.id, {status: "active"});
await getme.products.archive(product.id);
await getme.categories.create({name: "Menu", type: "product"});
await getme.brands.create({name: "Acme"});
await getme.services.create({name: "Consulting"});
Mutating resource methods generate an idempotency key automatically unless you provide one.
Website source
Create a standalone site directly from a complete custom source tree when no live site or base-theme selection exists:
const custom = await getme.sites.development.createFromSource({
name: "Custom storefront",
message: "Initial source",
files: customThemeFiles,
});
console.log(custom.site_id, custom.id, custom.source_revision);
The API validates the full archive before creating the draft. custom.site_id and custom.id intentionally identify the same standalone development session. Subsequent source writes, previews, and publish requests use the existing development-session methods.
const session = await getme.sites.development.createSession("site_...", {
source_revision: "rev_live",
name: "Header update",
});
await getme.sites.development.pushBatch("site_...", session.id, {
source_revision: "rev_live",
files: {
"theme.json": JSON.stringify({name: "Updated theme"}),
},
});
await getme.sites.pages.upsertContent("site_...", session.id, "wpag_...", "en", {
source_revision: "rev_live",
values: {title: "Updated docs"},
});
const preview = await getme.sites.development.preview("site_...", session.id, {
expires_days: 7,
});
console.log(preview.preview_url);
Source and page content writes are staged in the development session. They do not publish to the live site. Create a publish request when the change is ready for owner review.
Webhook verification
Use webhook helpers with the raw request body. Do not verify a parsed JSON body.
import {constructEvent} from "@getme-tech/getme-node/webhooks";
const event = constructEvent(rawBody, signatureHeader, "whsec_...");
console.log(event.type);
For local tests, generate signed fixtures without calling the network:
import {generateTestPayload, generateTestHeader} from "@getme-tech/getme-node/webhooks/testing";
const payload = generateTestPayload({
id: "wevt_test",
object: "event",
type: "booking.cancelled",
environment: "test",
livemode: false,
});
const signatureHeader = generateTestHeader(payload.rawBody, "whsec_test");