fix: readme

This commit is contained in:
Davidson Gomes 2023-06-12 13:35:47 -03:00
parent 5759341c52
commit 1efe7f7cde
6 changed files with 57 additions and 24 deletions

View File

@ -1,18 +1,15 @@
<h1 align="center">Evolution Api</h1> <h1 align="center">Evolution Api</h1>
<!--
</br>
<hr style="height: 5px;background: #007500;margin: 20px 0;box-shadow: 0px 3px 5px 0px rgb(204 204 204);">-->
<!-- <div align="center"> --> <div align="center">
<!-- [![Telegram Group](https://img.shields.io/badge/Group-Telegram-%2333C1FF)](#) <!-- [![Telegram Group](https://img.shields.io/badge/Group-Telegram-%2333C1FF)](#)-->
[![Whatsapp Group](https://img.shields.io/badge/Group-WhatsApp-%2322BC18)](#) <!-- [![Whatsapp Group](https://img.shields.io/badge/Group-WhatsApp-%2322BC18)](#) -->
[![License](https://img.shields.io/badge/license-GPL--3.0-orange)](./LICENSE) [![License](https://img.shields.io/badge/license-GPL--3.0-orange)](./LICENSE)
[![Support](https://img.shields.io/badge/Buy%20me-coffe-orange)](https://app.picpay.com/user/davidsongomes1998) --> [![Support](https://img.shields.io/badge/Buy%20me-coffe-orange)](https://app.picpay.com/user/davidsongomes1998)
<!-- </div> --> </div>
<!-- <div align="center"><img src="./public/images/cover.png"></div>-> --> <div align="center"><img src="./public/images/cover.png"></div>
## WhatsApp-Api-NodeJs ## WhatsApp-Api-NodeJs
@ -44,7 +41,7 @@ sudo usermod -aG docker ${USER}
### Nodejs installation ### Nodejs installation
```sh ```sh
nvm install 16.17.0 nvm install 16.18.1
``` ```
### pm2 installation ### pm2 installation
@ -72,7 +69,7 @@ Using the database is optional.
Cloning the Repository Cloning the Repository
``` ```
git clone https://github.com/code-chat-br/whatsapp-api.git git clone https://github.com/EvolutionAPI/evolution-api.git
``` ```
Go to the project directory and install all dependencies.</br> Go to the project directory and install all dependencies.</br>
@ -91,7 +88,7 @@ npm run start
npm run start:prod npm run start:prod
# pm2 # pm2
pm2 start 'npm run start:prod' --name ApiCodechat pm2 start 'npm run start:prod' --name ApiEvolution
``` ```
## Authentication ## Authentication
@ -121,7 +118,7 @@ Content-Type: application/json
apikey: t8OOEeISKzpmc3jjcMqBWYSaJH2PIxns apikey: t8OOEeISKzpmc3jjcMqBWYSaJH2PIxns
{ {
"instanceName": "codechat" "instanceName": "evolution"
} }
``` ```
##### cURL ##### cURL
@ -131,7 +128,7 @@ curl --location --request POST 'http://localhost:8080/instance/create' \
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \
--header 'apikey: t8OOEeISKzpmc3jjcMqBWYSaJH2PIxns' \ --header 'apikey: t8OOEeISKzpmc3jjcMqBWYSaJH2PIxns' \
--data-raw '{ --data-raw '{
"instanceName": "codechat" "instanceName": "evolution"
}' }'
``` ```
### Response ### Response
@ -139,7 +136,7 @@ curl --location --request POST 'http://localhost:8080/instance/create' \
```ts ```ts
{ {
"instance": { "instance": {
"instanceName": "codechat", "instanceName": "evolution",
"status": "created" "status": "created"
}, },
"hash": { "hash": {
@ -155,23 +152,23 @@ curl --location --request POST 'http://localhost:8080/instance/create' \
##### HTTP ##### HTTP
```http ```http
GET /instance/connect/codechat HTTP/1.1 GET /instance/connect/evolution HTTP/1.1
Host: localhost:8080 Host: localhost:8080
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9. [...] Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9. [...]
``` ```
```http ```http
GET /instance/connect/codechat HTTP/1.1 GET /instance/connect/evolution HTTP/1.1
Host: localhost:8080 Host: localhost:8080
apikey: 88513847-1B0E-4188-8D76-4A2750C9B6C3 apikey: 88513847-1B0E-4188-8D76-4A2750C9B6C3
``` ```
##### cURL ##### cURL
```bash ```bash
curl --location --request GET 'http://localhost:8080/instance/connect/codechat' \ curl --location --request GET 'http://localhost:8080/instance/connect/evolution' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9. [...]' --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9. [...]'
``` ```
```bash ```bash
curl --location --request GET 'http://localhost:8080/instance/connect/codechat' \ curl --location --request GET 'http://localhost:8080/instance/connect/evolution' \
--header 'apikey: 88513847-1B0E-4188-8D76-4A2750C9B6C3' --header 'apikey: 88513847-1B0E-4188-8D76-4A2750C9B6C3'
``` ```
@ -188,7 +185,7 @@ curl --location --request GET 'http://localhost:8080/instance/connect/codechat'
- [docker run](./docker.sh) - [docker run](./docker.sh)
- [docker-compose](./docker-compose.yml) - [docker-compose](./docker-compose.yml)
- [env for docker](./Docker/.env) - [env for docker](./Docker/.env)
- [DockerHub-codechat/api](https://hub.docker.com/r/codechat/api) - [DockerHub Evolution API](https://hub.docker.com/repository/docker/davidsongomes/evolution-api)
After building the application, in the same directory as the files above, run the following command: After building the application, in the same directory as the files above, run the following command:
```sh ```sh
@ -198,17 +195,17 @@ docker-compose up
| | | | | |
|-----|---| |-----|---|
| Send Text | ✔ | | Send Text | ✔ |
| Send Buttons | ✔ |
| Send Template | ❌ | | Send Template | ❌ |
| Send Media: audio - video - image - document - gif <br></br>base64: ```true``` | ✔ | | Send Media: audio - video - image - document - gif <br></br>base64: ```true``` | ✔ |
| Send Media File | ❌ | | Send Media File | ❌ |
| Send Audio type WhatsApp | ✔ | | Send Audio type WhatsApp | ✔ |
| Send Location | ✔ | | Send Location | ✔ |
| Send List | ✔ |
| Send Link Preview | ✔ | | Send Link Preview | ✔ |
| Send Contact | ✔ | | Send Contact | ✔ |
| Send Reaction - emoji | ✔ | | Send Reaction - emoji | ✔ |
| Send Poll Message | ✔ | | Send Poll Message | ✔ |
| Send Buttons (Deprecated) | ❌ |
| Send List (Deprecated) | ❌ |
## Postman collections ## Postman collections
- [Postman Json](./postman.json) - [Postman Json](./postman.json)
@ -236,6 +233,29 @@ docker-compose up
| GROUP_PARTICIPANTS_UPDATE | group-participants.update | JSON | Notifies when an action occurs involving a participant</br>'add' | 'remove' | 'promote' | 'demote' | | GROUP_PARTICIPANTS_UPDATE | group-participants.update | JSON | Notifies when an action occurs involving a participant</br>'add' | 'remove' | 'promote' | 'demote' |
| NEW_TOKEN | new.jwt | JSON | Notifies when the token (jwt) is updated | NEW_TOKEN | new.jwt | JSON | Notifies when the token (jwt) is updated
## Webhook Routes
When enabling the WEBHOOK_BY_EVENTS options in the global and local webhooks, the following paths will be added at the end of the webhook.
| Name | Route |
|------|-------|
| APPLICATION_STARTUP | https://url_webhook/application-startup |
| QRCODE_UPDATED | https://url_webhook/qrcode-updated |
| CONNECTION_UPDATE | https://url_webhook/connection-update |
| MESSAGES_SET | https://url_webhook/messages-set |
| MESSAGES_UPSERT | https://url_webhook/messages-upsert |
| MESSAGES_UPDATE | https://url_webhook/messages-update |
| SEND_MESSAGE | https://url_webhook/send-message |
| CONTACTS_SET | https://url_webhook/contacts-set |
| CONTACTS_UPSERT | https://url_webhook/contacts-upsert |
| CONTACTS_UPDATE | https://url_webhook/contacts-update |
| PRESENCE_UPDATE | https://url_webhook/presence-update |
| CHATS_SET | https://url_webhook/chats-set |
| CHATS_UPDATE | https://url_webhook/chats-update |
| CHATS_UPSERT | https://url_webhook/chats-upsert |
| GROUPS_UPSERT | https://url_webhook/groups-upsert |
| GROUPS_UPDATE | https://url_webhook/groups-update |
| GROUP_PARTICIPANTS_UPDATE | https://url_webhook/groups-participants-update |
| NEW_TOKEN | https://url_webhook/new-token |
## Env File ## Env File
See additional settings that can be applied through the **env** file by clicking **[here](./src/dev-env.yml)**. See additional settings that can be applied through the **env** file by clicking **[here](./src/dev-env.yml)**.
@ -254,8 +274,6 @@ This code was produced based on the baileys library and it is still under develo
# Donate to the project. # Donate to the project.
#### Pix: 2b526ada-4ef4-4db4-bbeb-f60da2421fce
#### PicPay #### PicPay
<div align="center"> <div align="center">

15
docker.sh Normal file
View File

@ -0,0 +1,15 @@
#!/bin/bash
NET='evolution-net'
IMAGE='evolution/api:local'
if !(docker network ls | grep ${NET} > /dev/null)
then
docker network create -d bridge ${NET}
fi
sudo mkdir -p /data/instances
docker build -t ${IMAGE} .
docker run -d --restart 'always' --name 'evolution_api' --mount 'type=bind,source=/data/instances,target=/evolution/instances' --publish '8083:8083' --hostname 'evolution' --network ${NET} ${IMAGE}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB