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

peelo

v1.2.3

Published

SDK officiel pour l'API WhatsApp Peelo

Readme

Peelo SDK

SDK officiel Node.js pour intégrer l'API WhatsApp Peelo dans vos applications.

Installation

npm install peelo

Prérequis

  • Node.js >= 14
  • Une clé API Peelo (format pk_...)

Initialisation

const { PeeloClient } = require('peelo');

const client = new PeeloClient('pk_votre_cle_api');

Fonctionnalités

  • Envoi de messages (Texte, Image, Vidéo, Document, Audio, Localisation, Sticker, Contacts)
  • Messages interactifs (Boutons, Listes, Demande de localisation)
  • Templates WhatsApp (Marketing, Utility, OTP/Authentification)
  • Indicateur de frappe (typing indicator)
  • Réactions à des messages
  • Marquage des messages comme lus
  • Rate Limiting automatique — le SDK gère une file d'attente interne pour ne pas dépasser 10 requêtes/seconde

Utilisation

Envoyer un message texte

await client.sendText('221771234567', 'Bonjour !');

// Avec aperçu de lien
await client.sendText('221771234567', 'Visitez https://peelo.chat', { preview_url: true });

Envoyer une image

await client.sendImage('221771234567', 'https://example.com/image.jpg', 'Ma légende');

Envoyer une vidéo

await client.sendVideo('221771234567', 'https://example.com/video.mp4', 'Ma légende');

Envoyer un document

await client.sendDocument('221771234567', 'https://example.com/facture.pdf', 'facture.pdf', 'Votre facture');

Envoyer un audio

await client.sendAudio('221771234567', 'https://example.com/audio.mp3');

Envoyer une localisation

await client.sendLocation('221771234567', 14.6928, -17.4467, 'Dakar', 'Sénégal');

Envoyer un sticker

// Par URL (webp)
await client.sendSticker('221771234567', 'https://example.com/sticker.webp');

// Par ID
await client.sendSticker('221771234567', 'sticker-id-ici');

Envoyer des contacts

await client.sendContacts('221771234567', [
    {
        name: { first_name: 'Jean', last_name: 'Dupont' },
        phones: [{ phone: '+221771234567', type: 'MOBILE' }]
    }
]);

Réagir à un message

await client.sendReaction('221771234567', 'wamid.HBg...', '❤️');

// Supprimer une réaction
await client.sendReaction('221771234567', 'wamid.HBg...', '');

Marquer un message comme lu

await client.markAsRead('wamid.HBg...');

Indicateur de frappe

await client.sendTypingIndicator('221771234567', 'wamid.HBg...');

Messages Interactifs

Boutons de réponse rapide

Maximum 3 boutons.

await client.sendReplyButtons('221771234567', 'Confirmez-vous votre commande ?', {
    'btn_yes': 'Oui, confirmer',
    'btn_no': 'Non, annuler'
});

Liste de choix (menu)

await client.sendList(
    '221771234567',
    'Choisissez un produit',   // Corps du message
    'Voir le menu',             // Texte du bouton d'ouverture
    [
        {
            title: 'Nos Pizzas',
            rows: [
                { id: 'piz_1', title: 'Marguerite', description: 'Tomate, Mozza' },
                { id: 'piz_2', title: 'Reine', description: 'Tomate, Mozza, Jambon' }
            ]
        },
        {
            title: 'Nos Boissons',
            rows: [
                { id: 'boi_1', title: 'Coca-Cola', description: '33cl' }
            ]
        }
    ],
    'Menu du Restaurant'        // Titre (optionnel)
);

Demande de localisation

await client.sendLocationRequest('221771234567', 'Veuillez partager votre position pour la livraison.');

Message interactif personnalisé

await client.sendInteractive('221771234567', {
    type: 'button',
    body: { text: 'Choisissez une option' },
    action: {
        buttons: [
            { type: 'reply', reply: { id: 'opt_1', title: 'Option 1' } }
        ]
    }
});

Templates

Template simple

await client.sendTemplate('221771234567', 'hello_world', 'fr');

Template Marketing (image + variables)

await client.sendMarketingTemplate(
    '221771234567',
    'promo_ete',                        // Nom du template
    'fr',                               // Langue
    'https://example.com/promo.jpg',    // Image d'en-tête (null si aucune)
    ['Jean', '-50%']                    // Variables : {{1}}=Jean, {{2}}=-50%
);

Template Utility (variables seulement)

// Variables positionnelles ({{1}}, {{2}}...)
await client.sendUtilityTemplate('221771234567', 'confirmation_rdv', 'fr', ['Lundi 10h', 'Dr. Martin']);

// Variables nommées
await client.sendUtilityTemplate('221771234567', 'confirmation_rdv', 'fr', {
    date: 'Lundi 10h',
    medecin: 'Dr. Martin'
});

// Sans variable
await client.sendUtilityTemplate('221771234567', 'simple_notif', 'fr');

Template OTP / Authentification

// Bouton ONE_TAP (auto-remplissage)
await client.sendOTP({
    to: '221771234567',
    templateName: 'auth_otp',
    language: 'fr',
    otp_code: '483921',
    otp_type: 'ONE_TAP'    // ou 'COPY_CODE'
});

Gestion des erreurs

Toutes les méthodes retournent une Promise. Utilisez try/catch pour gérer les erreurs.

try {
    const response = await client.sendText('221771234567', 'Bonjour !');
    console.log('Message envoyé, ID :', response.messages[0].id);
} catch (error) {
    console.error('Statut HTTP :', error.status);
    console.error('Message :', error.message);
}

Rate Limiting

Le SDK intègre un rate limiter automatique fixé à 10 requêtes/seconde. Toutes les requêtes sont mises en file d'attente et traitées séquentiellement dans la limite autorisée. Vous n'avez rien à configurer.


Licence

ISC — © Peelo