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.
In the project directory, you can run:
First open http://localhost:5000/auth/getqr
- scan the code with your whatsapp.
- Then check Auth http://localhost:5000/auth/checkauth
- IF every thing work great. Continue testing your 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',})
- 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
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.
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
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
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