Quick Start

Get up and running with WAKit in less than 5 minutes.

Installation

WAKit is published on npm and supports Node.js 18+. To install the latest version:

npm install @atharvh01/wakit

If you are using Yarn or pnpm:

yarn add @atharvh01/wakit
# or
pnpm add @atharvh01/wakit

Basic Usage

WAKit uses the WAKitClient architecture, which sits on top of the underlying socket to provide an incredible developer experience.

import { WAKitClient } from '@atharvh01/wakit';

async function startBot() {
  const client = new WAKitClient({
    sessionName: 'my-bot-session',
    loggerLevel: 'info',
  });

  // Simple message listener
  client.on('message', async (message) => {
    if (message.text === '!ping') {
      await client.sendMessage(message.chatId, { text: 'Pong!' });
    }
  });

  await client.initialize();
}

startBot();

What just happened?

  1. WAKitClient orchestrates the entire session lifecycle automatically.
  2. We provided a sessionName. WAKit uses its internal JsonFileStore to manage and persist your multi-device credentials locally under WAKit_auth_info/.
  3. We listened to the normalized message event. No need to parse raw messages.upsert protobuf nodes—WAKit handles that for you.
  4. We called client.sendMessage(), which automatically handles retries, delays, and state synchronization.

Next, check out Architecture to understand the difference between the low-level Socket and the high-level Client, or explore Plugins to see how to extend your bot.