@nextengage/sdk
Official TypeScript SDK for the NextEngage marketing platform.
Install
pnpm add @nextengage/sdk
Usage
import { NextEngage } from "@nextengage/sdk";
const ne = new NextEngage({
apiKey: process.env.NEXTENGAGE_API_KEY!,
baseUrl: "https://api.nextengage.io",
});
await ne.contacts.upsert({
email: "ada@example.com",
attributes: { country: "IN", plan: "pro" },
});
await ne.contacts.track({ email: "ada@example.com", name: "purchased", properties: { amount: 49 } });
await ne.contacts.bulkImport([
{ email: "a@x.com" },
{ email: "b@x.com", attributes: { vip: true } },
]);
const tpl = await ne.templates.create({ name: "Promo", subject: "Hi {{ email }}", body: "<p>Sale!</p>" });
const campaign = await ne.campaigns.create({ name: "Spring", templateId: tpl.id, fromEmail: "news@acme.com" });
await ne.campaigns.send(campaign.id);
The API key is scoped to a single project; the SDK resolves the project id
automatically from /me.
Error handling
Failed requests throw NextEngageError with status and parsed body.