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?
WAKitClientorchestrates the entire session lifecycle automatically.- We provided a
sessionName. WAKit uses its internalJsonFileStoreto manage and persist your multi-device credentials locally underWAKit_auth_info/. - We listened to the normalized
messageevent. No need to parse rawmessages.upsertprotobuf nodes—WAKit handles that for you. - 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.