Skip to content

Maru-Yasa/whastapp-http-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


whastapp-http-wrapper

◦ Seamless communication made simple!

◦ Developed with the software and tools listed below.

JavaScript Axios Express JSON

GitHub top language GitHub code size in bytes GitHub commit activity GitHub license

📒 Table of Contents


📍 Overview

The core purpose of the project is to provide a HTTP wrapper for the WhatsApp messaging platform. It allows users to send WhatsApp messages through a RESTful API, providing a simplified and flexible way to integrate WhatsApp messaging into their applications. The project's value proposition lies in offering developers an easy-to-use solution to incorporate WhatsApp functionality dynamically and seamlessly into their projects.


⚙️ Features

Feature Description
⚙️ Architecture The system follows a server-side architecture using Express.js. It utilizes routers and middleware to handle incoming requests and set up routes for various functionalities.
📖 Documentation Documentation seems to be lacking or incomplete. It would be beneficial to have more detailed explanations of each component's functionalities and usage.
🔗 Dependencies The system relies on Express.js for server functionality and routing, dotenv for environment variables, consola for logging, express-validator for request validation, and qr-image for generating QR codes. It also uses Axios for making HTTP requests.
🧩 Modularity The codebase is well-structured, with separate files for different functionalities like routes, hooks, and utils. This approach allows for modular development and easy handling of codebase components.
✔️ Testing No information is available about testing strategies or tools. Integration and unit tests should be added to ensure the reliability of the codebase.
⚡️ Performance Performance can be analyzed with a dedicated benchmark. However, based on the implementation, the codebase appears to be well-structured and should run efficiently with good resource usage.
🔐 Security The codebase lacks explicit security measures. Additional security practices like input validation and authentication should be implemented to enhance data protection and prevent unauthorized access.
🔀 Version Control The Git repository allows for version control and collaboration between developers. However, no information is available regarding the specific version control strategies or tools used.
🔌 Integrations The system primarily interacts with WhatsApp, utilizing the WhatsApp web client. It also interacts with external libraries for generating QR codes and making HTTP requests.
📶 Scalability The system's scalability depends on the underlying infrastructure and the chosen hosting solution. Express.js is capable of handling increased traffic, but specific scaling techniques or strategies are not outlined in the codebase.

📂 Project Structure


🧩 Modules

Root
File Summary
config.js This code exports the PORT and WEB_HOOK variables, reading them from dotenv configuration file or using default values.
app.js This code sets up an Express server with body-parser middleware. It also imports and uses a router, sets up a message hook, and listens for requests on a specified port.
Hooks
File Summary
index.js This code exports the messageHook function which can be used to handle messages in an application or system.
message.js This code sets up a message event listener using the Client object. When a message is received, it sends a POST request to a webhook endpoint with the message body. It logs the success or failure of the request using the consola package. If the request fails with an AxiosError, it logs the error code.
Routes
File Summary
index.js This code sets up routes for QR generation and sending messages using express. It imports the QR route and send message route, then uses them to handle corresponding requests. The router is exported for use in the main application.
qr.js This code defines a router that handles GET requests and generates a QR code image when a request is made. It listens for a QR code event emitted by a client, then uses a QR code generator to create the image. If no QR code is available, it sends an empty response.
sendMessage.js This code exports a router module that handles HTTP POST requests to send messages using a custom messaging client. It validates the'to' and'message' fields in the request body using express-validator. If successful, it calls the sendMessage function from the client module to send the message to the specified contact. It returns a JSON response indicating the success or failure of the message sending process.
Utils
File Summary
client.js The code initializes a WhatsApp web client and handles authentication and loading events. It uses the consola library for logging. The client emits'authenticated' and'ready' events when the authentication and initialization processes are complete, respectively. The client object is exported for external use.
QR.js The code exports a function called "generateQr" that uses the "qr-image" package to generate QR codes.

🚀 Getting Started

✔️ Prerequisites

Before you begin, ensure that you have the following prerequisites installed:

  • ℹ️ Requirement 1
  • ℹ️ Requirement 2
  • ℹ️ ...

📦 Installation

  1. Clone the whastapp-http-wrapper repository:
git clone https://github.com/Maru-Yasa/whastapp-http-wrapper.git
  1. Change to the project directory:
cd whastapp-http-wrapper
  1. Install the dependencies:
npm install

🎮 Using whastapp-http-wrapper

node app.js

🧪 Running Tests

npm test

🗺 Roadmap

  • ℹ️ Task 1: Implement X
  • ℹ️ Task 2: Refactor Y
  • ℹ️ ...

🤝 Contributing

Contributions are always welcome! Please follow these steps:

  1. Fork the project repository. This creates a copy of the project on your account that you can modify without affecting the original project.
  2. Clone the forked repository to your local machine using a Git client like Git or GitHub Desktop.
  3. Create a new branch with a descriptive name (e.g., new-feature-branch or bugfix-issue-123).
git checkout -b new-feature-branch
  1. Make changes to the project's codebase.
  2. Commit your changes to your local branch with a clear commit message that explains the changes you've made.
git commit -m 'Implemented new feature.'
  1. Push your changes to your forked repository on GitHub using the following command
git push origin new-feature-branch
  1. Create a new pull request to the original project repository. In the pull request, describe the changes you've made and why they're necessary. The project maintainers will review your changes and provide feedback or merge them into the main branch.

📄 License

This project is licensed under the ℹ️ INSERT-LICENSE-TYPE License. See the LICENSE file for additional info.


👏 Acknowledgments

  • ℹ️ List any resources, contributors, inspiration, etc.

About

Simple WhatsApp HTTP API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published