Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@whiskeysockets/baileys

Package Overview
Dependencies
Maintainers
0
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@whiskeysockets/baileys

WhatsApp API

  • 6.7.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
209K
increased by11.03%
Maintainers
0
Weekly downloads
 
Created

What is @whiskeysockets/baileys?

@whiskeysockets/baileys is a powerful Node.js library for interacting with the WhatsApp Web API. It allows developers to send and receive messages, manage contacts, and handle multimedia content, among other functionalities.

What are @whiskeysockets/baileys's main functionalities?

Sending Messages

This feature allows you to send text messages to a WhatsApp user. The code sample demonstrates how to connect to WhatsApp and send a simple text message.

const { WAConnection } = require('@whiskeysockets/baileys');
const conn = new WAConnection();

async function sendMessage() {
  await conn.connect();
  const id = '1234567890@s.whatsapp.net';
  const message = 'Hello, this is a test message!';
  await conn.sendMessage(id, message, 'conversation');
}
sendMessage();

Receiving Messages

This feature allows you to receive messages from WhatsApp users. The code sample shows how to set up an event listener to handle incoming messages.

const { WAConnection } = require('@whiskeysockets/baileys');
const conn = new WAConnection();

conn.on('message-new', async (message) => {
  console.log('Received message:', message);
});

async function start() {
  await conn.connect();
}
start();

Managing Contacts

This feature allows you to manage your WhatsApp contacts. The code sample demonstrates how to retrieve the list of contacts.

const { WAConnection } = require('@whiskeysockets/baileys');
const conn = new WAConnection();

async function getContacts() {
  await conn.connect();
  const contacts = await conn.getContacts();
  console.log('Contacts:', contacts);
}
getContacts();

Handling Multimedia

This feature allows you to send multimedia content such as images. The code sample demonstrates how to send an image to a WhatsApp user.

const { WAConnection, MessageType } = require('@whiskeysockets/baileys');
const conn = new WAConnection();

async function sendImage() {
  await conn.connect();
  const id = '1234567890@s.whatsapp.net';
  const imagePath = './path/to/image.jpg';
  await conn.sendMessage(id, { url: imagePath }, MessageType.image);
}
sendImage();

Other packages similar to @whiskeysockets/baileys

Keywords

FAQs

Package last updated on 22 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc