New to the SDK? Read the TypeScript SDK overview first.

Install

npm install @wazapin/sdk

Set your API key

export WAZAPIN_API_KEY="wzp_..."

Find your channel id

import { WazapinClient } from "@wazapin/sdk";

const wazapin = new WazapinClient();

const { data: channels } = await wazapin.channels.list({ limit: 10 });

console.log(channels.items[0]?.id); // use as channel_id
Connect WhatsApp in the app first if the list is empty. See Connect your channel.

Send a text message

import { WazapinClient, textMessage } from "@wazapin/sdk";

const wazapin = new WazapinClient();

const { data: message } = await wazapin.messages.send(
  textMessage({
    channel_id: "wzp_ch_123",
    to: "6281234567890",
    body: "Hello from Wazapin",
  }),
);

console.log("sent", message.id);

Check API health

const { data: health } = await wazapin.system.health();

console.log(health.status);