Zaptickdocs
Get started

Quickstart

Five minutes from zero to a delivered WhatsApp message.

#1. Create an API key

Head to the dashboard and create a test key. Test keys route through the same API but don't charge your wallet — perfect for local development.

You'll see the key exactly once
Keys are hashed at rest. Copy the plaintext value into your secrets manager the moment it's shown — we can't recover it for you.

#2. Install the SDK

npm install zaptick

#3. Send your first message

send-welcome.ts
import Zaptick from 'zaptick';

const zaptick = new Zaptick({
  apiKey: process.env.ZAPTICK_API_KEY!,
});

const result = await zaptick.messages.send({
  phone: '+919876543210',
  templateName: 'welcome_message',
  language: 'en',
  variables: { '1': 'Priya' },
});

console.log(result.messageId); // wamid.HBgNOTEy...

You must use a pre-approved WhatsApp template for the first message to a user, or be inside an open 24-hour window from a user-initiated conversation. For free-form replies, use zaptick.messages.sendText.

#4. Handle errors

Every method throws typed errors. You can discriminate them by class or error.code:

TypeScript
import Zaptick, {
  ZaptickAuthError,
  ZaptickRateLimitError,
  ZaptickValidationError,
} from 'zaptick';

try {
  await zaptick.messages.send({ ... });
} catch (err) {
  if (err instanceof ZaptickAuthError) {
    // rotate your key
  } else if (err instanceof ZaptickRateLimitError) {
    await new Promise(r => setTimeout(r, err.retryAfterSeconds * 1000));
  } else if (err instanceof ZaptickValidationError) {
    console.error(err.fieldErrors);
  }
}

#5. Listen for delivery events

Register a webhook to receive status updates, incoming replies, and campaign completion events.

TypeScript
import { verifyWebhookSignature } from 'zaptick/webhooks';

export async function POST(req: Request) {
  const body = await req.text();
  const sig = req.headers.get('x-zaptick-signature')!;
  const timestamp = req.headers.get('x-zaptick-timestamp')!;

  const ok = verifyWebhookSignature({
    payload: body,
    signature: sig,
    timestamp,
    secret: process.env.ZAPTICK_WEBHOOK_SECRET!,
  });

  if (!ok) return new Response('invalid signature', { status: 401 });

  const event = JSON.parse(body);
  console.log(event.type, event.data);
  return new Response('ok');
}