npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@lildiop2/evo-go

v0.1.1

Published

Typed, resilient TypeScript SDK for Evolution Go WhatsApp Gateway

Readme

@lildiop2/evo-go

Typed, resilient TypeScript SDK for Evolution GO — The high-performance Go WhatsApp API Gateway.

npm version License: MIT TypeScript Node.js


⚡ Features

  • 🎯 Complete API Coverage: Native support for the 79 endpoints of Evolution GO.
  • 🔄 Fluent Instance Scoping: Global administrative operations alongside instance-scoped clients (client.instance('name')).
  • 🛡️ Resilient Transport: Built on @lildiop2/utils with exponential backoff retries, jitter, and automatic HTTP 429 (RateLimitError) handling with Retry-After.
  • 📦 Dual Output: First-class ESM (.js) and CommonJS (.cjs) builds with TypeScript .d.ts declaration files.
  • 📡 Typed Webhook Events: Full type definitions and payload parsers for all WhatsApp real-time events.
  • 🧩 Zod Validation Schemas: Included for client configurations, message payloads, and instance setup.

📦 Installation

npm install @lildiop2/evo-go
# or
pnpm add @lildiop2/evo-go
# or
yarn add @lildiop2/evo-go

🚀 Quick Start

Initializing the Client

import { EvoClient } from '@lildiop2/evo-go';

const evo = new EvoClient({
  baseURL: 'http://localhost:4000',
  apiKey: process.env.EVO_GLOBAL_API_KEY, // Global API key for administration
});

// List all instances
const response = await evo.instances.listAll();
console.log(response.data);

Instance-Scoped Operations

Evolution GO scopes most WhatsApp actions to a specific instance token:

// Create an instance-scoped client
const sales = evo.instance('sales', 'your-instance-token');

// 1. Connect and fetch QR Code
await sales.connect();
const qr = await sales.getQRCode();
console.log('Scan QR Code:', qr.data?.qrcode);

// 2. Or pair via phone number
const pairing = await sales.pair('5511999999999');
console.log('Pairing code:', pairing.data?.pairingCode);

// 3. Send a text message
const message = await sales.messages.sendText({
  number: '5511999999999',
  text: 'Hello from Evolution GO SDK!',
});
console.log('Message ID:', message.data?.Info?.ID);

💡 Exemplos de Código / Code Examples

1. Envio de Mensagens de Mídia (Imagem, Áudio, Documento)

O método sendMedia aceita URLs públicas ou dados codificados em Base64:

// 1. Envio de imagem com legenda
await instance.messages.sendMedia({
  number: '5511999999999',
  mediatype: 'image',
  media: 'https://example.com/imagem.png',
  caption: 'Confira nossa nova promoção! 🌟',
});

// 2. Envio de documento PDF com nome de arquivo personalizado
await instance.messages.sendMedia({
  number: '5511999999999',
  mediatype: 'document',
  media: 'https://example.com/fatura.pdf',
  fileName: 'fatura-outubro.pdf',
  caption: 'Segue em anexo a sua fatura.',
});

// 3. Envio de áudio / mensagem de voz
await instance.messages.sendMedia({
  number: '5511999999999',
  mediatype: 'audio',
  media: 'https://example.com/audio.mp3',
});

2. Envio de Pagamento PIX (sendPix)

Envia uma mensagem interativa nativa com solicitação de pagamento via PIX:

await instance.messages.sendPix({
  number: '5511999999999',
  title: 'Cobrança do Pedido #8821',
  description: 'Clique no botão abaixo para pagar via chave PIX',
  footer: 'Evo-Go Pay',
  buttonText: 'Pagar com PIX',
  merchantName: 'Loja Oficial',
  pixKey: '5511999999999', // Chave PIX (telefone, email, cpf, cnpj ou evp)
  keyType: 'phone',         // 'phone' | 'email' | 'cpf' | 'cnpj' | 'random'
  amount: 2500,             // R$ 25,00 (valor em centavos)
  itemName: 'Assinatura Mensal',
});

3. Publicação de Status / Stories (status@broadcast)

Publique novidades no status do WhatsApp para todos os contatos:

// Status em texto
await instance.messages.sendStatusText({
  text: 'Novidade no ar! Versão 2.0 lançada com sucesso 🚀🔥',
});

// Status com mídia (imagem ou vídeo)
await instance.messages.sendStatusMedia({
  type: 'image',
  url: 'https://example.com/banner-stories.jpg',
  caption: 'Acesse nosso site e garanta seu desconto!',
});

4. Link com Metadados e Preview

await instance.messages.sendLink({
  number: '5511999999999',
  url: 'https://github.com/lildiop2/evo-go',
  title: 'SDK Evo-Go',
  description: 'SDK TypeScript de Alta Performance para Evolution Go',
  text: 'Acesse nossa documentação no GitHub: https://github.com/lildiop2/evo-go',
});

5. Localização e Contato vCard

// Envio de localização geográfica
await instance.messages.sendLocation({
  number: '5511999999999',
  latitude: -19.916681,
  longitude: -43.934493,
  name: 'Praça da Liberdade',
  address: 'Belo Horizonte - MG, Brasil',
});

// Envio de cartão de contato vCard
await instance.messages.sendContact({
  number: '5511999999999',
  contacts: [
    {
      fullName: 'Suporte Técnico',
      phoneNumber: '+5511999999999',
      organization: 'Minha Empresa',
      email: '[email protected]',
    },
  ],
});

6. Enquete Interativa e Figurinha (Sticker)

// Enquete interativa
await instance.messages.sendPoll({
  number: '5511999999999',
  name: 'Qual o melhor horário para atendimento?',
  options: ['Manhã ☀️', 'Tarde 🌤️', 'Noite 🌙'],
  selectableCount: 1,
});

// Figurinha / Sticker (convertida automaticamente pela Evolution Go)
await instance.messages.sendSticker({
  number: '5511999999999',
  media: 'https://example.com/sticker-image.png',
});

7. Interações: Reação, Edição, Deleção e Status de Entrega

const sent = await instance.messages.sendText({
  number: '5511999999999',
  text: 'Mensagem original',
});
const msgId = sent.data?.Info?.ID;

// 1. Reagir com emoji
await instance.messages.react({
  key: { remoteJid: '[email protected]', id: msgId, fromMe: true },
  reaction: '👍',
});

// 2. Editar mensagem enviada
await instance.messages.edit({
  key: { remoteJid: '[email protected]', id: msgId, fromMe: true },
  text: 'Mensagem editada com sucesso! ✏️',
});

// 3. Consultar status de entrega
const status = await instance.messages.getStatus({ id: msgId });
console.log('Status da mensagem:', status.data?.result?.status); // 'Delivered', 'Read', etc.

// 4. Revogar/Deletar mensagem para todos
await instance.messages.delete({
  key: { remoteJid: '[email protected]', id: msgId },
});

8. Atualização de Presença no Chat

// Indicando que está digitando...
await instance.messages.updatePresence({
  number: '5511999999999',
  presence: 'composing',
});

// Parando a digitação
await instance.messages.updatePresence({
  number: '5511999999999',
  presence: 'paused',
});

📖 Module Reference

1. Instances (evo.instances / instance.instances)

  • create(payload) — Create a new WhatsApp instance
  • listAll() — List all registered instances
  • getInfo(instanceId) — Detailed information of an instance
  • delete(instanceId) — Remove an instance
  • connect(options) — Connect session (QR or background)
  • getQRCode() — Get current QR Code
  • pair({ phone }) — Generate 8-digit pairing code
  • getStatus() — Connection status
  • disconnect() — Disconnect session
  • reconnect() — Reconnect session
  • logout() — Terminate session and clear credentials
  • setProxy(instanceId, proxy) / removeProxy(instanceId)
  • getAdvancedSettings(instanceId) / updateAdvancedSettings(instanceId, settings)

2. Messages (instance.messages)

  • sendText({ number, text, delay, quoted })
  • sendPix({ number, merchantName, pixKey, keyType, amount, itemName }) — Native interactive PIX payment request
  • sendStatusText({ text, id }) — Post text status (stories) to status@broadcast
  • sendStatusMedia({ type, url, caption, id }) — Post image/video status to status@broadcast
  • sendMedia({ number, media, mediatype, caption, fileName })
  • sendLink({ number, text, title, description, image })
  • sendLocation({ number, latitude, longitude, name, address })
  • sendContact({ number, contacts: [...] })
  • sendPoll({ number, name, options, selectableCount })
  • sendSticker({ number, media })
  • sendButton({ number, buttons: [...] })
  • sendList({ number, description, buttonText, sections })
  • react({ key, reaction }) — React with emoji
  • markRead({ keys }) — Mark messages as read
  • edit({ key, text }) — Edit sent message
  • delete({ key }) — Revoke message for everyone
  • updatePresence({ number, presence }) — typing, recording, paused
  • downloadMedia({ message }) — Decrypt and download media
  • getStatus({ id }) — Query message status

3. Users (instance.users)

  • checkNumber({ numbers }) — Verify WhatsApp registration
  • getInfo({ number }) — User profile details
  • getAvatar({ number }) — Profile picture URL
  • listContacts() — Get cached contacts
  • getPrivacy() / updatePrivacy(settings)
  • block({ number }) / unblock({ number }) / getBlocklist()
  • updateProfilePicture({ picture })
  • updateProfileName({ name })
  • updateProfileStatus({ status })

4. Groups (instance.groups)

  • list() — List all joined groups
  • create({ name, participants })
  • getInfo({ groupJid })
  • updateParticipants({ groupJid, action, participants }) (add, remove, promote, demote)
  • updatePhoto({ groupJid, photo })
  • updateName({ groupJid, name })
  • updateDescription({ groupJid, description })
  • getInviteLink({ groupJid })
  • join({ inviteCode })
  • leave({ groupJid })

5. Chats (instance.chats)

  • pin({ chatJid }) / unpin({ chatJid })
  • archive({ chatJid }) / unarchive({ chatJid })
  • mute({ chatJid, durationInSeconds }) / unmute({ chatJid })
  • syncHistory({ chatJid, count })

6. Labels (instance.labels)

  • list()
  • edit({ id, name, color })
  • addChat({ labelId, chatJid }) / removeChat({ labelId, chatJid })
  • addMessage({ labelId, chatJid, messageId }) / removeMessage(...)

7. Communities & Newsletters

  • instance.communities.create({ name, description })
  • instance.communities.addGroups({ communityJid, groupJids })
  • instance.newsletters.create({ name, description })
  • instance.newsletters.list()
  • instance.newsletters.subscribe({ newsletterJid })

📡 Webhook Handling

Safely receive and parse webhooks in your Express/Fastify/Next.js API routes:

import express from 'express';
import { parseWebhook, isWebhookPayload } from '@lildiop2/evo-go';

const app = express();
app.use(express.json());

app.post('/webhook', (req, res) => {
  if (!isWebhookPayload(req.body)) {
    return res.status(400).json({ error: 'Invalid payload' });
  }

  const event = parseWebhook(req.body);

  switch (event.event) {
    case 'Message': {
      const { remoteJid } = event.data.key;
      const text = event.data.message?.conversation;
      console.log(`Received message from ${remoteJid}: ${text}`);
      break;
    }
    case 'Connected': {
      console.log(`Instance connected on phone ${event.data.phone}`);
      break;
    }
    case 'Receipt': {
      console.log(`Delivered receipt for:`, event.data.messageIds);
      break;
    }
  }

  return res.sendStatus(200);
});

app.listen(3000, () => console.log('Webhook server running on port 3000'));

🛡️ Error Handling

The SDK exposes a typed error hierarchy inheriting from @lildiop2/utils:

import {
  EvoClient,
  EvoRateLimitError,
  EvoAPIError,
  EvoError
} from '@lildiop2/evo-go';

const evo = new EvoClient({ baseURL: 'http://localhost:4000', apiKey: 'secret' });

try {
  await evo.instance('billing', 'token').messages.sendText({
    number: '5511999999999',
    text: 'Invoice notification',
  });
} catch (error) {
  if (error instanceof EvoRateLimitError) {
    console.error(`Rate limited! Retry after ${error.retryAfterMs}ms`);
  } else if (error instanceof EvoAPIError) {
    console.error(`Evolution GO error [${error.statusCode}]:`, error.responseBody);
  } else if (error instanceof EvoError) {
    console.error(`SDK Error [${error.code}]:`, error.message);
  }
}

🛠️ Development & Testing

# Build dual ESM/CJS bundles
npm run build

# Run TypeScript checks
npm run typecheck

# Run linter
npm run lint

# Run Vitest test suite
npm test

# Run complete real-world live battery against an active Evolution GO server
node scripts/live-test.mjs
# (or use template with environment variables)
# EVO_BASE_URL="http://localhost:4000" TARGET_NUMBER="55..." node scripts/live-test.example.mjs

# Automated bump and publish to npm
npm run release

# Dry run publish simulation
npm run release -- --dry-run

📄 License

MIT © Abdul Kevin Alexis