Skip to content

PauloPenalva/whatsapp-sender

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

WhatsApp Message Sender

WhatsApp Message Sender

Send WhatsApp messages programmatically using this Node.js project!

Table of Contents

Introduction

This project allows you to send WhatsApp messages programmatically using the WhatsApp Web API and the whatsapp-web.js library. It provides a simple Node.js server with API endpoints to send messages to individual contacts or groups on WhatsApp.

Installation

  1. Clone this repository to your local machine:
git clone https://github.com/PauloPenalva/whatsapp.git
  1. Install the required dependencies:
cd whatsapp
npm install

Usage

  1. Before running the project, you need to set up the environment variables. Create a .env file in the project root directory and add the following:
PORT=3333
  1. To start the server, run the following command:
npm start
  1. Open your web browser and navigate to http:https://localhost:3333. You should see a QR code displayed. Scan this QR code using the WhatsApp app on your phone to log in and authenticate the WhatsApp Web session.

API Endpoints

Get All Groups

  • URL: /groups
  • Method: GET
  • Description: Retrieve a list of all WhatsApp groups you are a member of.

Send Message

  • URL: /send-message
  • Method: POST
  • Description: Send a WhatsApp message to an individual contact or a group.

Request Body

{
  "to": "recipient_number",
  "message": "your_message_here",
  "isGroup": true
}
  • to: The recipient's phone number in international format (e.g., +551234567890) or the group ID with the @g.us suffix for groups.
  • message: The message content you want to send.
  • isGroup: Set to true if the recipient is a group, false if it's an individual contact.

Response

{
  "status": true,
  "message": "Message sent successfully"
}

Contributing

Contributions are welcome! If you have any suggestions, bug reports, or feature requests, please open an issue or submit a pull request. For major changes, please open an issue first to discuss your ideas.

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published