Coder Social home page Coder Social logo

canove / whaticket-community Goto Github PK

View Code? Open in Web Editor NEW
1.5K 123.0 790.0 120.2 MB

A very simple Ticket System based on WhatsApp messages, that allow multi-users in same WhatsApp account.

License: MIT License

JavaScript 66.00% HTML 0.17% Shell 0.29% TypeScript 33.06% Dockerfile 0.48%
whatsapp bot tickets chat javascript

whaticket-community's Introduction

Donate FOSSA Status Quality Gate Status Maintainability Rating Discord Chat Forum

WhaTicket!

NOTE: The new version of whatsapp-web.js required Node 14. Upgrade your installations to keep using it.

A very simple Ticket System based on WhatsApp messages.

Backend uses whatsapp-web.js to receive and send WhatsApp messages, create tickets from them and store all in a MySQL database.

Frontend is a full-featured multi-user chat app bootstrapped with react-create-app and Material UI, that comunicates with backend using REST API and Websockets. It allows you to interact with contacts, tickets, send and receive WhatsApp messages.

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.

How it works?

On every new message received in an associated WhatsApp, a new Ticket is created. Then, this ticket can be reached in a queue on Tickets page, where you can assign ticket to your yourself by aceppting it, respond ticket message and eventually resolve it.

Subsequent messages from same contact will be related to first open/pending ticket found.

If a contact sent a new message in less than 2 hours interval, and there is no ticket from this contact with pending/open status, the newest closed ticket will be reopen, instead of creating a new one.

Screenshots

Features

  • Have multiple users chating in same WhatsApp Number βœ…
  • Connect to multiple WhatsApp accounts and receive all messages in one place βœ… πŸ†•
  • Create and chat with new contacts without touching cellphone βœ…
  • Send and receive message βœ…
  • Send media (images/audio/documents) βœ…
  • Receive media (images/audio/video/documents) βœ…

Installation and Usage (Linux Ubuntu - Development)

Create Mysql Database using docker: Note: change MYSQL_DATABASE, MYSQL_PASSWORD, MYSQL_USER and MYSQL_ROOT_PASSWORD.

docker run --name whaticketdb -e MYSQL_ROOT_PASSWORD=strongpassword -e MYSQL_DATABASE=whaticket -e MYSQL_USER=whaticket -e MYSQL_PASSWORD=whaticket --restart always -p 3306:3306 -d mariadb:latest --character-set-server=utf8mb4 --collation-server=utf8mb4_bin

# Or run using `docker-compose` as below
# Before copy .env.example to .env first and set the variables in the file.
docker-compose up -d mysql

# To administer this mysql database easily using phpmyadmin. 
# It will run by default on port 9000, but can be changed in .env using `PMA_PORT`
docker-compose -f docker-compose.phpmyadmin.yaml up -d

Install puppeteer dependencies:

sudo apt-get install -y libxshmfence-dev libgbm-dev wget unzip fontconfig locales gconf-service libasound2 libatk1.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

Clone this repo

git clone https://github.com/canove/whaticket/ whaticket

Go to backend folder and create .env file:

cp .env.example .env
nano .env

Fill .env file with environment variables:

NODE_ENV=DEVELOPMENT      #it helps on debugging
BACKEND_URL=http://localhost
FRONTEND_URL=https://localhost:3000
PROXY_PORT=8080
PORT=8080

DB_HOST=                  #DB host IP, usually localhost
DB_DIALECT=
DB_USER=
DB_PASS=
DB_NAME=

JWT_SECRET=3123123213123
JWT_REFRESH_SECRET=75756756756

Install backend dependencies, build app, run migrations and seeds:

npm install
npm run build
npx sequelize db:migrate
npx sequelize db:seed:all

Start backend:

npm start

Open a second terminal, go to frontend folder and create .env file:

nano .env
REACT_APP_BACKEND_URL = http://localhost:8080/ # Your previous configured backend app URL.

Start frontend app:

npm start
  • Go to http://your_server_ip:3000/signup
  • Create an user and login with it.
  • On the sidebard, go to Connections page and create your first WhatsApp connection.
  • Wait for QR CODE button to appear, click it and read qr code.
  • Done. Every message received by your synced WhatsApp number will appear in Tickets List.

Basic production deployment

Using Ubuntu 20.04 VPS

All instructions below assumes you are NOT running as root, since it will give an error in puppeteer. So let's start creating a new user and granting sudo privileges to it:

adduser deploy
usermod -aG sudo deploy

Now we can login with this new user:

su deploy

You'll need two subdomains forwarding to yours VPS ip to follow these instructions. We'll use myapp.mydomain.com to frontend and api.mydomain.com to backend in the following example.

Update all system packages:

sudo apt update && sudo apt upgrade

Install node, and confirm node command is available:

curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
node -v
npm -v

Install docker and add you user to docker group:

sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt update
sudo apt install docker-ce
sudo systemctl status docker
sudo usermod -aG docker ${USER}
su - ${USER}

Create Mysql Database using docker: Note: change MYSQL_DATABASE, MYSQL_PASSWORD, MYSQL_USER and MYSQL_ROOT_PASSWORD.

docker run --name whaticketdb -e MYSQL_ROOT_PASSWORD=strongpassword -e MYSQL_DATABASE=whaticket -e MYSQL_USER=whaticket -e MYSQL_PASSWORD=whaticket --restart always -p 3306:3306 -d mariadb:latest --character-set-server=utf8mb4 --collation-server=utf8mb4_bin

# Or run using `docker-compose` as below
# Before copy .env.example to .env first and set the variables in the file.
docker-compose up -d mysql

# To administer this mysql database easily using phpmyadmin. 
# It will run by default on port 9000, but can be changed in .env using `PMA_PORT`
docker-compose -f docker-compose.phpmyadmin.yaml up -d

Clone this repository:

cd ~
git clone https://github.com/canove/whaticket whaticket

Create backend .env file and fill with details:

cp whaticket/backend/.env.example whaticket/backend/.env
nano whaticket/backend/.env
NODE_ENV=
BACKEND_URL=https://api.mydomain.com      #USE HTTPS HERE, WE WILL ADD SSL LATTER
FRONTEND_URL=https://myapp.mydomain.com   #USE HTTPS HERE, WE WILL ADD SSL LATTER, CORS RELATED!
PROXY_PORT=443                            #USE NGINX REVERSE PROXY PORT HERE, WE WILL CONFIGURE IT LATTER
PORT=8080

DB_HOST=localhost
DB_DIALECT=
DB_USER=
DB_PASS=
DB_NAME=

JWT_SECRET=3123123213123
JWT_REFRESH_SECRET=75756756756

Install puppeteer dependencies:

sudo apt-get install -y libxshmfence-dev libgbm-dev wget unzip fontconfig locales gconf-service libasound2 libatk1.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

Install backend dependencies, build app, run migrations and seeds:

cd whaticket/backend
npm install
npm run build
npx sequelize db:migrate
npx sequelize db:seed:all

Start it with npm start, you should see: Server started on port... on console. Hit CTRL + C to exit.

Install pm2 with sudo, and start backend with it:

sudo npm install -g pm2
pm2 start dist/server.js --name whaticket-backend

Make pm2 auto start after reboot:

pm2 startup ubuntu -u `YOUR_USERNAME`

Copy the last line outputed from previus command and run it, its something like:

sudo env PATH=\$PATH:/usr/bin pm2 startup ubuntu -u YOUR_USERNAME --hp /home/YOUR_USERNAM

Go to frontend folder and install dependencies:

cd ../frontend
npm install

Create frontend .env file and fill it ONLY with your backend address, it should look like this:

REACT_APP_BACKEND_URL = https://api.mydomain.com/

Build frontend app:

npm run build

Start frontend with pm2, and save pm2 process list to start automatically after reboot:

pm2 start server.js --name whaticket-frontend
pm2 save

To check if it's running, run pm2 list, it should look like:

deploy@ubuntu-whats:~$ pm2 list
β”Œβ”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ id  β”‚ name                    β”‚ namespace   β”‚ version β”‚ mode    β”‚ pid      β”‚ uptime β”‚ .    β”‚ status    β”‚ cpu      β”‚ mem      β”‚ user     β”‚ watching β”‚
β”œβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 1   β”‚ whaticket-frontend      β”‚ default     β”‚ 0.1.0   β”‚ fork    β”‚ 179249   β”‚ 12D    β”‚ 0    β”‚ online    β”‚ 0.3%     β”‚ 50.2mb   β”‚ deploy   β”‚ disabled β”‚
β”‚ 6   β”‚ whaticket-backend       β”‚ default     β”‚ 1.0.0   β”‚ fork    β”‚ 179253   β”‚ 12D    β”‚ 15   β”‚ online    β”‚ 0.3%     β”‚ 118.5mb  β”‚ deploy   β”‚ disabled β”‚
β””β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Install nginx:

sudo apt install nginx

Remove nginx default site:

sudo rm /etc/nginx/sites-enabled/default

Create a new nginx site to frontend app:

sudo nano /etc/nginx/sites-available/whaticket-frontend

Edit and fill it with this information, changing server_name to yours equivalent to myapp.mydomain.com:

server {
  server_name myapp.mydomain.com;

  location / {
    proxy_pass http://127.0.0.1:3333;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_cache_bypass $http_upgrade;
  }
}

Create another one to backend api, changing server_name to yours equivalent to api.mydomain.com, and proxy_pass to your localhost backend node server URL:

sudo cp /etc/nginx/sites-available/whaticket-frontend /etc/nginx/sites-available/whaticket-backend
sudo nano /etc/nginx/sites-available/whaticket-backend
server {
  server_name api.mydomain.com;

  location / {
    proxy_pass http://127.0.0.1:8080;
    ......
}

Create a symbolic links to enable nginx sites:

sudo ln -s /etc/nginx/sites-available/whaticket-frontend /etc/nginx/sites-enabled
sudo ln -s /etc/nginx/sites-available/whaticket-backend /etc/nginx/sites-enabled

By default, nginx limit body size to 1MB, which isn't enough for some media uploads. Lets change it to 20MB, adding a new line to config file:

sudo nano /etc/nginx/nginx.conf
...
http {
    ...
    client_max_body_size 20M; # HANDLE BIGGER UPLOADS
}

Test nginx configuration and restart server:

sudo nginx -t
sudo service nginx restart

Now, enable SSL (https) on your sites to use all app features like notifications and sending audio messages. An easy way to this is using Certbot:

Install certbot:

sudo snap install --classic certbot
sudo apt update

Enable SSL on nginx (Fill / Accept all information required):

sudo certbot --nginx

Using docker and docker-compose

To run WhaTicket using docker you must perform the following steps:

cp .env.example .env

Now it will be necessary to configure the .env using its information, the variables are the same as those mentioned in the deployment using ubuntu, with the exception of mysql settings that were not in the .env.

# MYSQL
MYSQL_ENGINE=                           # default: mariadb
MYSQL_VERSION=                          # default: 10.6
MYSQL_ROOT_PASSWORD=strongpassword      # change it please
MYSQL_DATABASE=whaticket
MYSQL_PORT=3306                         # default: 3306; Use this port to expose mysql server
TZ=America/Fortaleza                    # default: America/Fortaleza; Timezone for mysql

# BACKEND
BACKEND_PORT=                           # default: 8080; but access by host not use this port
BACKEND_SERVER_NAME=api.mydomain.com
BACKEND_URL=https://api.mydomain.com
PROXY_PORT=443
JWT_SECRET=3123123213123                # change it please
JWT_REFRESH_SECRET=75756756756          # change it please

# FRONTEND
FRONTEND_PORT=80                        # default: 3000; Use port 80 to expose in production
FRONTEND_SSL_PORT=443                   # default: 3001; Use port 443 to expose in production
FRONTEND_SERVER_NAME=myapp.mydomain.com
FRONTEND_URL=https://myapp.mydomain.com

# BROWSERLESS
MAX_CONCURRENT_SESSIONS=                # default: 1; Use only if using browserless

After defining the variables, run the following command:

docker-compose up -d --build

On the first run it will be necessary to seed the database tables using the following command:

docker-compose exec backend npx sequelize db:seed:all

SSL Certificate

To deploy the ssl certificate, add it to the ssl/certs folder. Inside it there should be a backend and a frontend folder, and each of them should contain the files fullchain.pem and privkey.pem, as in the structure below:

.
β”œβ”€β”€ certs
β”‚Β Β  β”œβ”€β”€ backend
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ fullchain.pem
β”‚Β Β  β”‚Β Β  └── privkey.pem
β”‚Β Β  └── frontend
β”‚Β Β      β”œβ”€β”€ fullchain.pem
β”‚Β Β      └── privkey.pem
└── www

To generate the certificate files use certbot which can be installed using snap, I used the following command:

Note: The frontend container that runs nginx is already prepared to receive the request made by certboot to validate the certificate.

# BACKEND
certbot certonly --cert-name backend --webroot --webroot-path ./ssl/www/ -d api.mydomain.com

# FRONTEND
certbot certonly --cert-name frontend --webroot --webroot-path ./ssl/www/ -d myapp.mydomain.com

Access Data

User: [email protected] Password: admin

Upgrading

WhaTicket is a working in progress and we are adding new features frequently. To update your old installation and get all the new features, you can use a bash script like this:

Note: Always check the .env.example and adjust your .env file before upgrading, since some new variable may be added.

nano updateWhaticket
#!/bin/bash
echo "Updating Whaticket, please wait."

cd ~
cd whaticket
git pull
cd backend
npm install
rm -rf dist
npm run build
npx sequelize db:migrate
npx sequelize db:seed
cd ../frontend
npm install
rm -rf build
npm run build
pm2 restart all

echo "Update finished. Enjoy!"

Make it executable and run it:

chmod +x updateWhaticket
./updateWhaticket

Contributing

This project helps you and you want to help keep it going? Buy me a coffee:

Buy Me A Coffee

Para doaçáes em BRL, utilize o Paypal:

Donate

Any help and suggestions will be apreciated.

Disclaimer

I just started leaning Javascript a few months ago and this is my first project. It may have security issues and many bugs. I recommend using it only on local network.

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.

whaticket-community's People

Contributors

alicompu avatar allgood avatar canove avatar cauelugli avatar dantecvip avatar dev-stupid-codes avatar dionatas-develcode avatar ertprs avatar esteves67 avatar filipeborelli avatar fogolin avatar horgun avatar igortrust avatar jhonnatanbezerra avatar kouthk avatar lipflip avatar macleysousa avatar optinzap avatar phegalante avatar ricardoapaes avatar rochac2lee avatar rtenorioh avatar tatosjb avatar tonnybarros avatar w3nder avatar wirys avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

whaticket-community's Issues

How to install on a web server specifically (hostiger)

Hello @canove interesting project, I would like to install it on the server (hostiger) where my website is located, how would the installation process be? Please if you could give me further indications. try to install it on localhost (local PC) and the Docker installation says it has trouble starting. I did not know how to continue.

preset messages whatsapp

Hello, i think that's a new enhancement is the system of presets messages, like:
Wellcome, busy, offline, custom msg.

[Feature Suggestion] Last message doesn't update if last message was sent by the bot in autorespond function

Hello! Thanks for the hard work into making Whaticket - Ticket System Client for Whatsapp!

I got a issue... i hope its not only me, if it is then sorry.
But, when using the Whaticket Backend with Whatsapp-Web.js auto responder functions like:

else if (msg.body == '!ping') {
        // Send a new message to the same chat
        wbot.sendMessage(msg.from, 'pong');

The last message doesn't get update on the Frontend Client when the message was sent by the bot in that auto respond function above,
the last message only updates if the last message was sent by the team/support agent (typed message).

So if the bot send like 3 auto messages, the last message shown on the Frontend Client its the message before those 3 messages that the bot sent, and not really the last message.

That also happens with any android auto responder whatsapp, just install an auto responder app for whatsapp on the phone and set your bot to reply to your customer, when the bot replies the customer, the team/support agent won't see the message that the bot has sent.

Example:
John Doe send message: " Hi "
Bot (whatsapp-web.js library) reply message: " Hey, how you doing "
Bot (any android app auto responder for whatsapp) reply message: " Hey, how you doing "
Last message shown on the Frontend to the team/support agent = " Hi ". (while it should be " Hey, how you doing ")

My code:

wbot.on("message", async msg => {
// console.log(msg);
if (msg.from === "status@broadcast" || msg.type === "location") {
return;
}
else if (msg.body == '!ping') {
        // Send a new message to the same chat
        wbot.sendMessage(msg.from, 'pong');
}

[Feature Suggestion] Recurso de Cadastramento na primeira interação.

Seria possΓ­vel , quando receber a primeira mensagem , colocar o nΓΊmero que fez contato em um estado de "QuestionΓ‘rio" aonde ele deve responder perguntas , como :

Qual seu Nome ?
Qual Idade ?
Qual Cidade ?

Algumas respostas necessitam de validação e algumas de confirmação.

Um exemplo :

image

image

Problemas em conexΓ΅es

Ao criar uma nova conexΓ£o o sistema faz o cadastro porΓ©m fica apenas em loading e nΓ£o aparece o qrcode, nΓ£o gera erro no console, nem algo do tipo.

No QR code?

Added a new user but it's neither asking for QR code nor showing any option to trigger one?

Screenshot at Sep 11 11-28-52

Other Session Problem?

i fresh installation to test the new version...

and i cant register accout... and you can logging with an inexistent accounts.

(i cleared the browser.)

all database has been installed without problems.

[Bug] Mysterious chat?

Not sure how this chat (notice no messages) found its way in there, it's not on phone and web.whatsapp.com

Screenshot at Sep 11 21-23-19

[Help] Running as root without --no-sandbox is not supported.

Definitely not a whatticket issue but where to add the --no-sandbox to run all of this as root?

[nodemon] starting `node src/app.js`
Server started on port: 8080
(node:23531) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!
[0828/114941.087419:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.

[Feature Suggestion] Ignore Group Messages

Hello!

Not a issue! [ Suggestion ]

Since my bot is also in some groups, i've been using in my Whaticket instance, the function msg.author != null.
What it does is that it ignores group messages.

Reason why im using that function:
I realized that someone send a message in a group the backend says it came from the person directly to me like if it were a private message not a group message. And it feels like the person is talking to me while the person is actually talking to the group.

I don't know if it will be useful inserting that code in Whaticket, but i wanted to point out what i found.

My code (wbotMessageListener.js):

wbot.on("message_create", async msg => {
		// console.log(msg);
		if (
			msg.from === "status@broadcast" ||
			msg.type === "location" ||
			msg.type === "call_log" ||
			msg.author != null  // Ignore Group Messages
		) {
			return;
		}

[Feature Suggestion] Webhooks for automation

I would like to suggest and ask for guidance on where to start looking for implementing webhooks, the idea is to push automated messages like this api.backend.com/?num=xxxxxxxx&action=quickreply1 we can also use the same to activate quick replies from the frontend as well.

ERRO DE CORS

Estou com um problema de CORS, quando tento fazer login na pÑgina de frontend, ele dÑ erro de CORS, pra usar a aplicação preciso usar uma extensão que altera o cabeçalho.

JΓ‘ tentei mudar em todas as rotas do projeto e adicionar

app.use(function(req, res, next) {
  res.header("Access-Control-Allow-Origin", "*"); 
  res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
  next();
});

porΓ©m mesmo assim nΓ£o dΓ‘ certo, alguma dica?

[Help] Error sending emoticon and login

Hello guys!
Did any of you guys have these errors while using whaticket and can you help me?

When wanting to send an emoticon, a page connection error message appears. But the emoticon is still sent to the recipient.
image

When the user tries to log in for the first time, an invalid session error appears as shown in the image. But if you try a second time, you will be logged in normally.
image

Thank you very much!

error npm run build frontend

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]~prebuild: [email protected]
6 info lifecycle [email protected]~build: [email protected]
7 verbose lifecycle [email protected]~build: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~build: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/deploy/whaticket/frontend/node_modules/.bin:/us$
9 verbose lifecycle [email protected]~build: CWD: /home/deploy/whaticket/frontend
10 silly lifecycle [email protected]~build: Args: [ '-c', 'react-scripts build' ]
11 silly lifecycle [email protected]~build: Returned: code: 1  signal: null
12 info lifecycle [email protected]~build: Failed to exec build script
13 verbose stack Error: [email protected] build: `react-scripts build`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:314:20)
13 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:314:20)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid [email protected]
15 verbose cwd /home/deploy/whaticket/frontend
16 verbose Linux 4.15.0-39-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "build"
18 verbose node v12.19.0
19 verbose npm  v6.14.8
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] build: `react-scripts build`
22 error Exit status 1
23 error Failed at the [email protected] build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Session

the session expire if u not send or update the web for 5 minuts aprox...

when reload the web... u can't login... u need delete cookies and more to can login again!

[Feature] Transfer ticket.

I will try to implement transfer ticket feature.

requirements:

  • change assigned operator;
  • log an system message informing about the transfer.

embed whatsapp

I saw that some screens on the system are similar to the whatsapp screen, did you recreate the interface or do you embed it?

[Bug] Few fixes..

A few fixes are needed:

A). Clicking Accept produces Error 500
Screenshot at Aug 26 08-31-46

B). Dialogs should use English as Default option.
Screenshot at Aug 26 08-32-03

Erro preview image

I have this erro in preview theimg whem i send or recive, the link is that:
undefined:undefined/public/1599703840204.jpg
the link that right : IP or DOMAIN:PORT/public/1599703840204.jpg

image

mySQL connection error

I am installing on AWS and getting a MySQL connection error.

In my .env file, I have localhost for the database name

ubuntu@ip-172-31-24-121:~/whaticket/backend$ npx sequelize db:migrate

Sequelize CLI [Node: 12.18.4, CLI: 5.5.1, ORM: 5.22.3]

Loaded configuration file "dist/config/database.js".

ERROR: Access denied for user 'whaticket'@'172.17.0.1' (using password: YES)

ubuntu@ip-172-31-24-121:~/whaticket/backend$

[Feature Suggestion] Outcome webhooks for automation

Create a background outcome webhooks for integration with other platforms.

When certain actions happens, it could call urls. On moments like:

1 - When a ticket was open.
2 - When a ticket was assigned.
3 - When a ticket was transferred.
4 - When a ticket was closed.
5 - When any message was enter(sent or received).
6 - When a message was received.
7 - When a message was sent.

So it could be integrated with many other sell platforms.

[Feature Suggestion] Line Break

Hi

Would be cool if we can have line break in the chat.

I noticed is that Whaticket isn't recognizing \n,
the backend console receives a message with \n, but when its inserted in the database the \n gets deleted.

Message body received in backend:

  hasMedia: false,
    body: 'Hello\nHello',
  type: 'chat',

Text shown in the frontend:

Hello Hello

While with line break \n, it would look like:

Hello
Hello

Pega as mensagens nao lidas (recebidas quando o bot estava offline)

OlΓ‘, percebi que no seu cΓ³digo estΓ‘ comentada os cΓ³digos:
const chats = await wbot.getChats();
let unreadMessages;
for (let chat of chats) {
if (chat.unreadCount > 0) {
unreadMessages = await chat.fetchMessages({
limit: chat.unreadCount,
});
Messageset.store(unreadMessages);
}
}
console.log(unreadMessages);

Mas percebi que estÑ incompleto, os dados não estão sendo armazenado no DB. Pergunto quais funçáes para que esses dados sejam tratados e armazenados no db?

check and double-check disappear

Hi, suddenly my check and double-check icons stop being shown that they were read or sent, it just shows the clock icon, however of this issue, the messages system is working fine. How can I fix it without relinking the session, I already tried restarting the backend and frontend but it didn't work, how can I address this issue?.
thanks.
Untitled

Help with heroku please

Hi!
First: I thank you very much for your project.
Second: Could you help me upload this project to heroku?
I am trying to upload it but heroku returns the error: Application not supported by 'heroku / nodejs' buildpack
I understand that it may be because the package.json is not found in the root. But in this case there are 2 package.json. One on frontend and one on backend.

Cannot GET /

Followed the tutorial to setup this on a Debanin 10 GCE instance. PM2 gives me:
pm2 list
β”Œβ”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ id β”‚ name β”‚ namespace β”‚ version β”‚ mode β”‚ pid β”‚ uptime β”‚ β†Ί β”‚ status β”‚ cpu β”‚ mem β”‚ user β”‚ watching β”‚
β”œβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 0 β”‚ whaticket-backend β”‚ default β”‚ 1.0.0 β”‚ fork β”‚ 1695 β”‚ 42s β”‚ 0 β”‚ online β”‚ 0% β”‚ 69.8mb β”‚ dee… β”‚ disabled β”‚
β”‚ 1 β”‚ whaticket-frontend β”‚ default β”‚ 0.1.0 β”‚ fork β”‚ 1738 β”‚ 27s β”‚ 0 β”‚ online β”‚ 0% β”‚ 40.7mb β”‚ dee… β”‚ disabled β”‚
β””β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

But accessing the domain shows error: Cannot GET /

EDIT:

When I run frontend in console it says : Local: http://localhost:3000 but in nginx config for frontend we used proxy_pass http://127.0.0.1:3333;? Could this be an issue? Also, I usd yarn instead of npm if that matters.

Mistake was whaticket is using two sub-domains, and I used one in nginx config.

[Error] Sequelize CLI

Hi.
When I tried to enter the command npx sequelize db:migrate the error appeared, do you know hot to solve it?

~/whaticket/backend$ npx sequelize db:migrate

Sequelize CLI [Node: 12.19.0, CLI: 5.5.1, ORM: 5.22.3]

Loaded configuration file "dist/config/database.js".

ERROR: Dialect needs to be explicitly supplied as of v4.0.0

Error when authenticated done

(node:3464) UnhandledPromiseRejectionWarning: Error: Evaluation failed: t
    at ExecutionContext._evaluateInternal (C:\Bots\whaticket-master\backend\node
_modules\puppeteer\lib\ExecutionContext.js:102:19)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async ExecutionContext.evaluate (C:\Bots\whaticket-master\backend\node_mo
dules\puppeteer\lib\ExecutionContext.js:33:16)
    at async Client.sendPresenceAvailable (C:\Bots\whaticket-master\backend\node
_modules\whatsapp-web.js\src\Client.js:537:16)
  -- ASYNC --
    at ExecutionContext.<anonymous> (C:\Bots\whaticket-master\backend\node_modul
es\puppeteer\lib\helper.js:94:19)
    at DOMWorld.evaluate (C:\Bots\whaticket-master\backend\node_modules\puppetee
r\lib\DOMWorld.js:89:24)
  -- ASYNC --
    at Frame.<anonymous> (C:\Bots\whaticket-master\backend\node_modules\puppetee
r\lib\helper.js:94:19)
    at Page.evaluate (C:\Bots\whaticket-master\backend\node_modules\puppeteer\li
b\Page.js:612:14)
    at Page.<anonymous> (C:\Bots\whaticket-master\backend\node_modules\puppeteer
\lib\helper.js:95:27)
    at Client.sendPresenceAvailable (C:\Bots\whaticket-master\backend\node_modul
es\whatsapp-web.js\src\Client.js:537:35)
    at Client.<anonymous> (C:\Bots\whaticket-master\backend\src\libs\wbot.js:69:
9)
(node:3464) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This
error originated either by throwing inside of an async function without a catch
block, or by rejecting a promise which was not handled with .catch(). To termina
te the node process on unhandled promise rejection, use the CLI flag `--unhandle
d-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejectio
ns_mode). (rejection id: 4)
(node:3464) UnhandledPromiseRejectionWarning: TimeoutError: waiting for selector
 "canvas" failed: timeout 45000ms exceeded
    at new WaitTask (C:\Bots\whaticket-master\backend\node_modules\puppeteer\lib
\DOMWorld.js:388:34)
    at DOMWorld._waitForSelectorOrXPath (C:\Bots\whaticket-master\backend\node_m
odules\puppeteer\lib\DOMWorld.js:313:26)
    at DOMWorld.waitForSelector (C:\Bots\whaticket-master\backend\node_modules\p
uppeteer\lib\DOMWorld.js:296:21)
    at Frame.waitForSelector (C:\Bots\whaticket-master\backend\node_modules\pupp
eteer\lib\FrameManager.js:384:51)
    at Frame.<anonymous> (C:\Bots\whaticket-master\backend\node_modules\puppetee
r\lib\helper.js:95:27)
    at Page.waitForSelector (C:\Bots\whaticket-master\backend\node_modules\puppe
teer\lib\Page.js:799:33)
    at Timeout.getQrCode (C:\Bots\whaticket-master\backend\node_modules\whatsapp
-web.js\src\Client.js:110:28)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:3464) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This
error originated either by throwing inside of an async function without a catch
block, or by rejecting a promise which was not handled with .catch(). To termina
te the node process on unhandled promise rejection, use the CLI flag `--unhandle
d-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejectio
ns_mode). (rejection id: 5)
(node:3464) UnhandledPromiseRejectionWarning: TimeoutError: waiting for selector
 "canvas" failed: timeout 45000ms exceeded
    at new WaitTask (C:\Bots\whaticket-master\backend\node_modules\puppeteer\lib
\DOMWorld.js:388:34)
    at DOMWorld._waitForSelectorOrXPath (C:\Bots\whaticket-master\backend\node_m
odules\puppeteer\lib\DOMWorld.js:313:26)
    at DOMWorld.waitForSelector (C:\Bots\whaticket-master\backend\node_modules\p
uppeteer\lib\DOMWorld.js:296:21)
    at Frame.waitForSelector (C:\Bots\whaticket-master\backend\node_modules\pupp
eteer\lib\FrameManager.js:384:51)
    at Frame.<anonymous> (C:\Bots\whaticket-master\backend\node_modules\puppetee
r\lib\helper.js:95:27)
    at Page.waitForSelector (C:\Bots\whaticket-master\backend\node_modules\puppe
teer\lib\Page.js:799:33)
    at Timeout.getQrCode (C:\Bots\whaticket-master\backend\node_modules\whatsapp
-web.js\src\Client.js:110:28)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:3464) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This
error originated either by throwing inside of an async function without a catch
block, or by rejecting a promise which was not handled with .catch(). To termina
te the node process on unhandled promise rejection, use the CLI flag `--unhandle
d-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejectio
ns_mode). (rejection id: 6)

other thing, i start this on aws vps, but the server was calling the privete IP note the public ip, how can i fix it?
image

[Feature Suggestion] Outcome Webhooks

Create a background outcome webhooks for integration with other platforms.

When certain actions happens, it could call urls. On moments like:

1 - When a ticket was open.
2 - When a ticket was assigned.
3 - When a ticket was transferred.
4 - When a ticket was closed.
5 - When any message was enter(sent or received).
6 - When a message was received.
7 - When a message was sent.

So it could be integrated with many other sell platforms.

[Question] How to upgrade

I would like to upgrade an existing install and test the ticket transfer feature. I followed the instructions for installation and I am getting the below error after running: npx sequelize db:seed:all

ubuntu@ip-172-31-24-121:~/whaticket/backend$ npx sequelize db:seed:all

Sequelize CLI [Node: 12.19.0, CLI: 5.5.1, ORM: 5.22.3]

Loaded configuration file "dist/config/database.js".
== 20200904070004-create-default-settings: migrating =======

ERROR: Validation error

What is the best way to upgrade an existing installation

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.