Skip to content

Node.js WhatsApp Library#

License GitHub release

Warning!!!

The version is outdated and left for compatibility. The current version of the documentation can be found at the link.

JavaScript library for integration with WhatsApp messenger via API of green-api.com service. To use the library you have to get a registration token and an instance id in the console. For testing, we recommend using the free "Developer" plan.

API#

You can find REST API documentation by url. The library is a wrapper for REST API, so the documentation at the above url applies to the library as well.

Authorization#

To send a message or to execute some other Green-API method, you have to have the WhatsApp account in the phone application to be authorized. To authorize your instance please go to the console and scan a QR-code using the WhatsApp application.

Development environment unrolling#

  1. Clone the repository via git clone
  2. Install dependencies via npm install
  3. Globally install the rollup library for building.
  4. For webhooks add express as a new dependency via npm
  5. Create a .env file in the root directory and set the environment variables. The example of variables are in the env.example file

Building#

You can compile both browser and node/webpack versions of the library with one command

npm run build

Examples of using#

Service methods documentation#

External products#

  • axios - for http requests
  • express - webhook applications server

License#

Licensed under Creative Commons Attribution-NoDerivatives 4.0 International (CC BY-ND 4.0).

Please see file LICENSE.