/Whatsapp-Chatbot

🐡 Full service whatsapp client and chatbot server

Primary LanguageJavaScript

PRETTIER LICENSE Hits

giff-wats


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

Special thanks for the structure CAIO

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

2020-08-15_20-39

$ npx knex migrate:latest

Insert data into Postgres

knex-seeds

$ npx knex seed:run

Sample request using CURL in the command line/terminal:

2020-08-15_20-38

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

2020-08-15_20-26

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:



Install through Github :octocat:

Best way to install is to clone it from Github

To clone/download the boilerplate

$ git clone https://github.com/lucioerlan/Whatsapp-Chatbot.git

After cloning

$ cd Whatsapp-Chatbot.git

Install all of the projects dependencies with:

$ npm install api and service

copy the .env-examples file to .env

$ cp .env-examples .env

running

$ npm start


Running with Docker 🐳

2020-08-15_20-43

$ docker-compose up

🔓 Licença

MIT © Erlan Lucio