GithubHelp home page GithubHelp logo

blakepro / whatsapp-api-puppeteer-nodejs Goto Github PK

View Code? Open in Web Editor NEW
23.0 7.0 8.0 144 KB

Unofficial API for WhatsApp (Bot / Webhook / Socket)

Home Page: https://github.com/BlakePro/WhatsAppApiNodeJS

JavaScript 87.80% PHP 6.04% HTML 6.15%
api nodejs puppeteer whatsapp whatsapp-api whatsapp-bot bot chrome whatsapp-php socket

whatsapp-api-puppeteer-nodejs's Introduction

Api WhatsApp Bot Unofficial

Unofficial API for WhatsApp

(Bot / Webhook / Socket)

Table of Contents

Install & Start

Install Dependencies

sudo npm i

Run WebService

npm test port=8333 headless=false debug=true message=true user=user pass=pass

Run WebService (background mode)

npm start port=8333 headless=true debug=false message=true user=user pass=pass &

Stop WebService (background mode)

ps aux | grep indexWhatsApp.js
kill -9 PID_NUMBER

Install from scratch

1. Install Git

sudo apt-get install git

2. Install Node [https://github.com/nodesource/distributions] (Node Distribution)

curl -sL https://deb.nodesource.com/setup_current.x | sudo -E bash -
sudo apt-get install -y nodejs

3. Install Utilities from Puppeteer

sudo apt-get install gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget

3.1 Linux Server

sudo apt-get install chromium-browser

4. Clone GitHub Repo

git clone https://github.com/BlakePro/WhatsAppWebApiNodeJS.git

NOTE: I can't guarantee you will not be blocked by using this method, although it has worked for me. WhatsApp does not allow bots or unofficial clients on their platform, so this shouldn't be considered totally safe.

Api

Endpoint Post
start bot: url
webhook: url
template null
contact number: string
picture number: string
seen number: string (required)
message number: string / list
message: string / list
media number: string (required)
option: json (required)


Option - File
{"caption": "", "attachment": "(base64)"
Option - Link Preview
{"content": "(url + string)", "preview": "true"
download option: json (required)
{"clientUrl": "", "mimetype": "", "mediaKey": "", "type": ""}
chat null
unread null
stats null
state null
me null
logout null
storage null

Examples (CURL)

Start

curl -X POST \
  http://localhost:8333/api/mytoken/start \
  -H 'content-type: application/x-www-form-urlencoded' \
  -d 'bot=http://localhost:8334/exampleBot.php&webhook=null&socket=null'

Send Message

curl -X POST \
  http://localhost:8333/api/mytoken/messsage \
  -H 'content-type: application/x-www-form-urlencoded' \
  -d 'number=5215512344567&message=HelloWorld'

Send Media

curl -X POST \
  http://localhost:8333/api/mytoken/media \
  -H 'content-type: application/x-www-form-urlencoded' \
  -d 'number=5215512345678&option='{"caption":"HelloFile","attachment":"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJmZWF0aGVyIGZlYXRoZXItY2lyY2xlIj48Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIxMCI+PC9jaXJjbGU+PC9zdmc+"}''

Bot (php)

  • Start Server PHP
  php -l 0.0.0.0:8334
  • Set bot URL in start API
  http://localhost:8334/exampleBot.php

Disclaimer

This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with WhatsApp or any of its subsidiaries or its affiliates. The official WhatsApp website can be found at https://whatsapp.com "WhatsApp" as well as related names, marks, emblems and images are registered trademarks of their respective owners.

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.