Official SDK for Node.js 18+. Send WhatsApp messages, manage contacts, and list templates with a few lines of code.
Install
bash
npm install nexwapi
# or from the monorepo
npm install ./sdk/nodejsQuick start
bash
import Nexwapi from "nexwapi";
const client = new Nexwapi({
apiKey: process.env.NEXWAPI_API_KEY,
});
await client.messages.sendText({
to: "919876543210",
text: "Hello from Nexwapi!",
});
await client.messages.sendTemplate({
to: "919876543210",
template: "otp_login",
params: ["123456"],
});
const me = await client.account.get();
console.log(me.plan);CommonJS
bash
const Nexwapi = require("nexwapi");
const client = new Nexwapi({ apiKey: process.env.NEXWAPI_API_KEY });Methods
client.account.get()client.messages.sendText({ to, text })client.messages.sendTemplate({ to, template, params?, language? })client.contacts.list / upsert / setOptInclient.templates.list()
Environment
NEXWAPI_API_KEY— secret keyNEXWAPI_BASE_URL— optional, defaulthttps://api.nexwapi.com
Errors
Throws NexwapiError with status, code, and body.