Giter Site home page Giter Site logo

haris-khan-durrani / whatsapp-web.js Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 96 KB

This Node.js application utilizes the whatsapp-web.js library to create a WhatsApp client server. Here's a breakdown of its functionality: Initialization and Setup: The application sets up an Express server and defines necessary dependencies like express, whatsapp-web.js, qrcode, cors, http, and mysql for database connectivity.

License: GNU General Public License v3.0

JavaScript 100.00%
nodejs whatsapp-web whatsapp-web-api whatsapp-web-automation whatsapp-web-js

whatsapp-web.js's People

Contributors

haris-khan-durrani avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

sameerlike141

whatsapp-web.js's Issues

You Can ask anything realted to this code

This Node.js application utilizes the whatsapp-web.js library to create a WhatsApp client server. Here's a breakdown of its functionality:

Initialization and Setup: The application sets up an Express server and defines necessary dependencies like express, whatsapp-web.js, qrcode, cors, http, and mysql for database connectivity.

Database Connection: It establishes a connection with a MySQL database to store session data.

Client Initialization: The createClient function initializes a WhatsApp client instance using the provided instanceId. It handles events like QR code generation, client readiness, authentication, authentication failure, and disconnection.

Endpoints:

/add-device/:instanceId: Initializes a new device session.
/get-qr/:instanceId: Fetches the QR code for a specific instance.
/send-message/:instanceId: Sends a text message to a specified number.
/send-media/:instanceId: Sends media (image or video) to a specified number.
/get-chat-backup/:instanceId: Retrieves chat backup for a specific instance.
/get-messages/:instanceId/:userId/:limitme: Retrieves messages for a specific user within a specified limit.
/get-media/:instanceId/:messageId: Retrieves media associated with a specific message.
/instance-status/:instanceId: Checks the status of a specific instance.
/get-active-instance-info/:instanceId: Retrieves information about the active instance, such as phone number and platform.
/get-contacts/:instanceId: Retrieves contacts for a specific instance.
/delete-device/:instanceId: Deletes an existing device session.
/reinit-client/:instanceId: Attempts to reinitialize the client connection without destroying the session.
/reinit-session/:instanceId: Reinitializes a session for a specific instance.
/reinit-all-sessions: Reinitializes all sessions with timeout handling.
Database Operations:

Loading sessions from the database during initialization.
Saving authenticated sessions to the database.
Updating session status in the database on disconnection.
Error Handling: The application handles errors gracefully, logging them and providing appropriate responses to clients.

Server Setup: The server listens on port 4000.

Overall, this application provides a robust backend for managing WhatsApp client sessions and interacting with the WhatsApp API programmatically.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.