https://github.com/lucioerlan/whatsapp-chatbot
🐡 Full service whatsapp client and chatbot server
https://github.com/lucioerlan/whatsapp-chatbot
api-rest node puppeteer whatsapp-bot
Last synced: 4 months ago
JSON representation
🐡 Full service whatsapp client and chatbot server
- Host: GitHub
- URL: https://github.com/lucioerlan/whatsapp-chatbot
- Owner: lucioerlan
- Created: 2020-08-16T09:18:33.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-06-17T18:50:12.000Z (10 months ago)
- Last Synced: 2024-12-09T20:28:09.293Z (5 months ago)
- Topics: api-rest, node, puppeteer, whatsapp-bot
- Language: JavaScript
- Homepage:
- Size: 918 KB
- Stars: 80
- Watchers: 8
- Forks: 27
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://gitter.im/jlongster/prettie)
[](https://github.com/arshadkazmi42/awesome-github-init/LICENSE)
[](https://hits.seeyoufarm.com)
# Description
This service communicates with whatsapp web, using the puppeteer. This bot is inspired by 99% of the bots I see out there on the internet, from e-commerces
Credits to the author of the library [PEDRO](https://github.com/pedroslopez)
Special thanks for the structure [CAIO](https://github.com/caioagiani)## 1 - API
The api has nothing to do with the service, the only thing it does is to communicate with the postgres database, I decided to post it too.
### Create table into Postgres

```sh
$ npx knex migrate:latest
```### Insert data into Postgres

```sh
$ npx knex seed:run
```### Sample request using CURL in the command line/terminal:

```
curl http://localhost:4001/api/user/38581407838 | python3 -m json.tool
```### Access the documentation for all methods in the swagger 🥇
http://localhost:4001/api/docs
## 1 - SERVICE
Scan QRCODE

Attention you need to do this, right after running npm install in the Service folder, open service/node_modules/whatsapp-web.js/src/Client.js and add these lines
---LINE 43
```
this.lastMessage = null;
```---LINE 441 up until 443
```
setPrevMessage(status){
this.lastMessage = status;
}
```This function is for the puppeteer to go back and forth between pages.
# Installations
### Requirements
You will need to install some stuff, if they are not yet installed in your machine:
* [Node.js (v4.3.2 or higher; LTS)](http://nodejs.org)
* [NPM (v3.5+; bundled with node.js installation package)](https://docs.npmjs.com/getting-started/installing-node#updating-npm)---
### Install through Github :octocat:
Best way to install is to clone it from Github
**To clone/download the boilerplate**
```bash
$ git clone https://github.com/lucioerlan/Whatsapp-Chatbot.git
```**After cloning**
```bash
$ cd Whatsapp-Chatbot.git
```**Install all of the projects dependencies with:**
```bash
$ npm install api and service```
### copy the .env-examples file to .env
```
$ cp .env-examples .env
```**running**
```bash
$ npm start```
---
### Running with Docker 🐳

```
$ docker-compose up
```## 🔓 Licença
MIT © [Erlan Lucio](https://www.linkedin.com/in/erlanlucio/)