Skip to content

A WhatsApp Application Programming Interface to Make things easy and free for learning purposes

License

Notifications You must be signed in to change notification settings

satish603/Whatsapp_API

Repository files navigation

Whatsapp_API

This code is in no way affiliated with, authorized, maintained, sponsored or endorsed by WhatsApp or any of its affiliates or subsidiaries. This is an independent and unofficial software. Use at your own risk. Commercial use of this code/repo is strictly prohibited.

Available Scripts

In the project directory, you can run:

npm install --force

How to RUN Applicaion

npm start

First open http://localhost:5000/auth/getqr

For testing api

  • open index.js and edit the ph number in post method and message in editor

Request Body axios.post('http://localhost:5000/chat/sendmessage/91123456789', {// ph number wih your country code.91 here indicates for india


message: 'hello world from heroku docker',})


DOCKER heroku deploy commands

Download and install Docker better follow official document.

  • heroku container:login
  • heroku create app_name
  • heroku container:push web -a app_name
  • heroku container:release web -a app_name
  • heroku open -a app_name

API Doc

Auth

Getting QR Code GET : /auth/getqr

Used to get a QR Code to Log into Whatsapp Web - If not logged in, returns a QR Code - If logged in, returns a "Authenticated" message.

Chat

Sending Messages POST : /chat/sendmessage/<phone_number>

Request Body

  • message - contains the message to be sent

Sending Images POST : /chat/sendimage/<phone_number>

Request Body

  • image - contains the base64 encoded / URL of image to be sent
  • caption - (optional) - contains caption for the message

Sending PDF POST : /chat/sendpdf/<phone_number>

Request Body

  • pdf - contains the base64 encoded / URL of pdf to be sent

Sending Locations POST : /chat/sendlocation/<phone_number>

Request Body

  • latitude - contains the string of latitude
  • longitude - contains the string of longitude
  • description - (optional) - contains description for the location

Get Chat By Id GET : /chat/getchatbyid/<phone_number>

Returns a Chat


Get Chats GET : /chat/getchats

Returns an Array of all Chats

Group Chat

Sending Messages to Group POST : /group/sendmessage/<Group_Name>

Request Body

  • message - contains the message to be sent

Sending Images POST : /group/sendimage/<Group_Name>

Request Body

  • image - contains the base64 encoded / URL of image to be sent
  • caption - (optional) - contains caption for the message

Sending PDF POST : /group/sendpdf/<Group_Name>

Request Body

  • pdf - contains the base64 encoded / URL of pdf to be sent

Sending Locations POST : /group/sendlocation/<Group_Name>

Request Body

  • latitude - contains the string of latitude
  • longitude - contains the string of longitude
  • description - (optional) - contains description for the location

Contact

Get Contacts GET : /contact/getcontacts

Returns an Array of Contacts of the Current Instance


Get Contact GET : /contact/getcontact/<phone_number>

Returns a Contact


Get Profile Pic GET : /contact/getprofilepic/<phone_number>

Returns a URL of the User's Profile Picture if Privacy Settings allow it


Is Registered User GET : /contact/isregistereduser/<phone_number>

Returns if a given User is registered on Whatsapp