Skip to content

jrCleber/call-service-whatsapp

Repository files navigation

call-service-whatsapp

Telegram Whatsapp GitHub yarn npm node nvm

Customer service via whatsapp

Have a number and several attendants and control all the service through whatsapp.
The main idea came from the need to have several attendants, segmented into sectors, with the possibility of managing the entire service process through whatsapp itself. Without the attendant needing to access any web page or an external application.

Infrastructure

Nvm installation

$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
# or
$ wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash

Docker installation

$ curl -fsSL https://get.docker.com -o get-docker.sh

$ sudo sh get-docker.sh

$ sudo usermod -aG docker ${USER}

$ sudo apt-get install docker-compose

After finishing, restart the terminal to load the new information.

Nodejs installation

$ nvm install 16.10.0

$ node --version

$ docker --version

$ docker-compose --version

Application startup

Install all dependencies.

$ yarn install
# or
$ npm i

The application depends on a MySql/MariaDB database.
If you don't have one:

Docker

$ cd Docker
$ docker-compose up

Prisma

The connection to the database is carried out through the prism orm.

For users who have permission to change the database, run the command:

$ yarn prisma:migrate

This command will migrate the modeling in the schema to the database.

For users without permission, execute the query in ./prisma/migration.sql, directly in the database.
At the end of the query, run the command:

$ yarn prisma:generate

The generate command generates assets for the Prisma Client based on the data model defined in the ./prism/schema.prisma file.

Creating the center and sectors

To insert the agents in the database, we first need to create the call center and sectors. See the example at ./prisma/create.ts.

We are now ready to launch the application in development mode.

$ yarn start:dev

Build

$ yarn build

$ yarn start

Commands

There are already ready commands, which you can insert directly into the chat during a call or outside a call, they are:

  • &end: ends the transaction;
    ├> sends a message to the client informing the termination of its protocol;
    ├> releases the user for a new service;
    └> sends a message to the attendant informing the termination.
  • &list: lists all transactions linked to the user and sends them to the attendant in
    xlsx format.
    • &list c=[id]: lists all transactions for a given user.
  • &customer: lists all clients and sends this information in xlsx format.
    • &customer c=[id]: retrieves all information for a specific customer;
    • &customer g=[id]: retriever a customer and start a call.
  • &transfer s=[sector name]: transfers the customer to the specified sector that
    had attendants.
  • &pause: not implemented:
    └> puts a given call on hold.
  • &status: not implemented:
    └> informs the status of a given service.

Commands can be created and edited at commands.ts.


Note

This code is in no way affiliated with WhatsApp. Use at your own discretion. Don't spam this.

This code was produced based on the baileys library and it is still under development.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published