General

General

Unstable , unreliable , minimalist Zalo Scraper library for Nodejs

About The Project

ZaloJS is a powerful high-level scraping API designed for accessing data from Zalo, a popular messaging platform in Vietnam. This versatile tool provides developers with the means to extract various types of data from Zalo, enabling them to build applications, gather insights, and automate tasks effectively.

Use Cases

  • Chatbot Development: Develop chatbots capable of interacting with Zalo users, responding to messages, providing information, and executing tasks.

  • Automated Workflows: Streamline repetitive tasks by automating actions within the Zalo client, such as sending notifications or gathering data.

Example Use

const { init } = require('zalojs');
const config = require('./config.json');
const Client = require('zalojs').default;
const fs = require('fs');
const path = require('path');

const prefix = '!';

(async () => {
  const { browser, page } = await init({
    groupName: config.gname,
    groupID: config.gselector,
    headless: config.headless,
  });

  const client = new Client(page);

  client.on('message', async (message) => {

    if (!message.content.startsWith(prefix)) return;
    const args = message.content.slice(prefix.length).trim().split(/ +/);
    const commandName = args.shift().toLowerCase();

    try {
    if (command === 'ping') {
      await client.send({ message :'!Pong' });
    }
    } catch (error) {
      console.log(error);
      await client.send({ message :'There was an error executing the command.' });
    }
  });

  client.once('ready', () => {
    console.log(`Bot is ready! ${client.user.name}`);
  });
})();

Last updated 3 days ago

Last updated