Skip to content

Commit e05690a

Browse files
committed
Merge branch 'release/1.1.0'
2 parents 66fa855 + 8e65dd0 commit e05690a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1801
-907
lines changed

.DS_Store

6 KB
Binary file not shown.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ yarn-debug.log*
1111
yarn-error.log*
1212
lerna-debug.log*
1313

14+
/store/*
15+
/docker-compose-data
16+
1417
# Package
1518
/yarn.lock
1619
/package-lock.json

CHANGELOG.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1+
# 1.1.0 (2023-06-21 11:17)
2+
3+
### Features
4+
5+
* Improved fetch instances endpoint, now it also fetch other instances even if they are not connected
6+
* Added conversion of audios for sending recorded audio, now it is possible to send mp3 audios and not just ogg
7+
* Route to fetch all groups that the connection is part of
8+
* Route to fetch all privacy settings
9+
* Route to update the privacy settings
10+
* Route to update group subject
11+
* Route to update group description
12+
* Route to accept invite code
13+
* Added configuration of events by webhook of instances
14+
* Now the api key can be exposed in fetch instances if the EXPOSE_IN_FETCH_INSTANCES variable is set to true
15+
* Added option to generate qrcode as soon as the instance is created
16+
* The created instance token can now also be optionally defined manually in the creation endpoint
17+
* Route to send Sticker
18+
19+
### Fixed
20+
21+
* Adjust dockerfile variables
22+
* tweaks in docker-compose to pass variables
23+
* Adjust the route getProfileBusiness to fetchProfileBusiness
24+
* fix error after logout and try to get status or to connect again
25+
* fix sending narrated audio on whatsapp android and ios
26+
* fixed the problem of not disabling the global webhook by the variable
27+
* Adjustment in the recording of temporary files and periodic cleaning
28+
* Fix for container mode also work only with files
29+
130
# 1.0.9 (2023-06-10)
231

332
### Fixed

Docker/.env

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,17 @@ LOG_COLOR=true
1212
DEL_INSTANCE=5
1313

1414
# Temporary data storage
15-
STORE_CLEANING_INTERVAL=7200 # seconds ===2h
16-
STORE_MESSAGE=true
15+
STORE_MESSAGES=true
16+
STORE_MESSAGE_UP=true
1717
STORE_CONTACTS=false
1818
STORE_CHATS=false
1919

20+
CLEAN_STORE_CLEANING_INTERVAL=7200 # seconds ===2h
21+
CLEAN_STORE_MESSAGES=true
22+
CLEAN_STORE_MESSAGE_UP=true
23+
CLEAN_STORE_CONTACTS=false
24+
CLEAN_STORE_CHATS=false
25+
2026
# Permanent data storage
2127
DATABASE_ENABLED=false
2228
DATABASE_CONNECTION_URI='<uri>'
@@ -70,6 +76,7 @@ AUTHENTICATION_TYPE='jwt' # or 'apikey'
7076
## Define a global apikey to access all instances.
7177
### OBS: This key must be inserted in the request header to create an instance.
7278
AUTHENTICATION_API_KEY='t8OOEeISKzpmc3jjcMqBWYSaJsafdefer'
79+
AUTHENTICATION_EXPOSE_IN_FETCH_INSTANCES=true
7380
## Set the secret key to encrypt and decrypt your token and its expiration time
7481
AUTHENTICATION_JWT_EXPIRIN_IN=3600 # seconds - 3600s ===1h | zero (0) - never expires
7582
AUTHENTICATION_JWT_SECRET='L0YWtjb2w554WFqPG'

Dockerfile

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,28 @@ COPY ./package.json .
99

1010
ENV DOCKER_ENV=true
1111

12+
ENV SERVER_TYPE="http"
13+
ENV SERVER_PORT=8080
14+
1215
ENV CORS_ORIGIN="*"
1316
ENV CORS_METHODS="POST,GET,PUT,DELETE"
1417
ENV CORS_CREDENTIALS=true
1518

1619
ENV LOG_LEVEL="ERROR,WARN,DEBUG,INFO,LOG,VERBOSE,DARK"
1720
ENV LOG_COLOR=true
1821

19-
ENV DEL_INSTANCE=false
22+
ENV DEL_INSTANCE=$DEL_INSTANCE
23+
24+
ENV STORE_MESSAGES=$STORE_MESSAGE
25+
ENV STORE_MESSAGE_UP=$STORE_MESSAGE_UP
26+
ENV STORE_CONTACTS=$STORE_CONTACTS
27+
ENV STORE_CHATS=$STORE_CHATS
2028

21-
ENV STORE_CLEANING_INTERVAL=7200
22-
ENV STORE_MESSAGE=true
23-
ENV STORE_CONTACTS=true
24-
ENV STORE_CHATS=true
29+
ENV CLEAN_STORE_CLEANING_INTERVAL=$CLEAN_STORE_CLEANING_INTERVAL
30+
ENV CLEAN_STORE_MESSAGES=$CLEAN_STORE_MESSAGE
31+
ENV CLEAN_STORE_MESSAGE_UP=$CLEAN_STORE_MESSAGE_UP
32+
ENV CLEAN_STORE_CONTACTS=$CLEAN_STORE_CONTACTS
33+
ENV CLEAN_STORE_CHATS=$CLEAN_STORE_CHATS
2534

2635
ENV DATABASE_ENABLED=$DATABASE_ENABLED
2736
ENV DATABASE_CONNECTION_URI=$DATABASE_CONNECTION_URI
@@ -37,7 +46,7 @@ ENV REDIS_ENABLED=$REDIS_ENABLED
3746
ENV REDIS_URI=$REDIS_URI
3847

3948
ENV WEBHOOK_GLOBAL_URL=$WEBHOOK_GLOBAL_URL
40-
ENV WEBHOOK_GLOBAL_ENABLED=true
49+
ENV WEBHOOK_GLOBAL_ENABLED=$WEBHOOK_GLOBAL_ENABLED
4150
ENV WEBHOOK_GLOBAL_WEBHOOK_BY_EVENTS=$WEBHOOK_GLOBAL_WEBHOOK_BY_EVENTS
4251

4352
ENV WEBHOOK_EVENTS_STATUS_INSTANCE=$WEBHOOK_EVENTS_STATUS_INSTANCE
@@ -59,19 +68,20 @@ ENV WEBHOOK_EVENTS_GROUPS_UPSERT=$WEBHOOK_EVENTS_GROUPS_UPSERT
5968
ENV WEBHOOK_EVENTS_GROUPS_UPDATE=$WEBHOOK_EVENTS_GROUPS_UPDATE
6069
ENV WEBHOOK_EVENTS_GROUP_PARTICIPANTS_UPDATE=$WEBHOOK_EVENTS_GROUP_PARTICIPANTS_UPDATE
6170

62-
ENV WEBHOOK_EVENTS_NEW_JWT_TOKEN=true
71+
ENV WEBHOOK_EVENTS_NEW_JWT_TOKEN=$WEBHOOK_EVENTS_NEW_JWT_TOKEN
6372

64-
ENV CONFIG_SESSION_PHONE_CLIENT="Evolution API"
73+
ENV CONFIG_SESSION_PHONE_CLIENT=$CONFIG_SESSION_PHONE_CLIENT
6574
ENV CONFIG_SESSION_PHONE_NAME="Chrome"
6675

67-
ENV QRCODE_LIMIT=30
76+
ENV QRCODE_LIMIT=$QRCODE_LIMIT
6877

69-
ENV AUTHENTICATION_TYPE="apikey"
78+
ENV AUTHENTICATION_TYPE=$AUTHENTICATION_TYPE
7079

7180
ENV AUTHENTICATION_API_KEY=$AUTHENTICATION_API_KEY
81+
ENV AUTHENTICATION_EXPOSE_IN_FETCH_INSTANCES=$AUTHENTICATION_EXPOSE_IN_FETCH_INSTANCES
7282

73-
ENV AUTHENTICATION_JWT_EXPIRIN_IN=0
74-
ENV AUTHENTICATION_JWT_SECRET="L0YWtjb2w554WFqPG"
83+
ENV AUTHENTICATION_JWT_EXPIRIN_IN=$AUTHENTICATION_JWT_EXPIRIN_IN
84+
ENV AUTHENTICATION_JWT_SECRET="L=0YWt]b2w[WF>#>:&E`"
7585

7686
ENV AUTHENTICATION_INSTANCE_NAME=$AUTHENTICATION_INSTANCE_NAME
7787
ENV AUTHENTICATION_INSTANCE_WEBHOOK_URL=$AUTHENTICATION_INSTANCE_WEBHOOK_URL

README.md

Lines changed: 47 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
<h1 align="center">Evolution Api</h1>
2-
<!--
3-
</br>
4-
<hr style="height: 5px;background: #007500;margin: 20px 0;box-shadow: 0px 3px 5px 0px rgb(204 204 204);">-->
52

6-
<!-- <div align="center"> -->
3+
<div align="center">
74

8-
<!-- [![Telegram Group](https://img.shields.io/badge/Group-Telegram-%2333C1FF)](#)
9-
[![Whatsapp Group](https://img.shields.io/badge/Group-WhatsApp-%2322BC18)](#)
5+
<!-- [![Telegram Group](https://img.shields.io/badge/Group-Telegram-%2333C1FF)](#)-->
6+
<!-- [![Whatsapp Group](https://img.shields.io/badge/Group-WhatsApp-%2322BC18)](#) -->
107
[![License](https://img.shields.io/badge/license-GPL--3.0-orange)](./LICENSE)
11-
[![Support](https://img.shields.io/badge/Buy%20me-coffe-orange)](https://app.picpay.com/user/davidsongomes1998) -->
8+
[![Support](https://img.shields.io/badge/Buy%20me-coffe-orange)](https://app.picpay.com/user/davidsongomes1998)
129

13-
<!-- </div> -->
10+
</div>
1411

15-
<!-- <div align="center"><img src="./public/images/cover.png"></div>-> -->
12+
<div align="center"><img src="./public/images/cover.png"></div>
1613

1714
## WhatsApp-Api-NodeJs
1815

19-
This project is based on the [CodeChat](https://github.com/code-chat-br/whatsapp-api). The original project is an implementation of [Baileys](https://github.com/adiwajshing/Baileys), serving as a Restful API service that controls WhatsApp functions.</br>
16+
This project is based on the [CodeChat](https://github.com/code-chat-br/whatsapp-api). The original project is an implementation of [Baileys](https://github.com/WhiskeySockets/Baileys), serving as a Restful API service that controls WhatsApp functions.</br>
2017
The code allows the creation of multiservice chats, service bots, or any other system that utilizes WhatsApp. The documentation provides instructions on how to set up and use the project, as well as additional information about its features and configuration options.
2118

2219
## Infrastructure
@@ -44,7 +41,7 @@ sudo usermod -aG docker ${USER}
4441
### Nodejs installation
4542

4643
```sh
47-
nvm install 16.17.0
44+
nvm install 16.18.1
4845
```
4946

5047
### pm2 installation
@@ -72,7 +69,7 @@ Using the database is optional.
7269

7370
Cloning the Repository
7471
```
75-
git clone https://github.com/code-chat-br/whatsapp-api.git
72+
git clone https://github.com/EvolutionAPI/evolution-api.git
7673
```
7774

7875
Go to the project directory and install all dependencies.</br>
@@ -91,7 +88,7 @@ npm run start
9188
npm run start:prod
9289

9390
# pm2
94-
pm2 start 'npm run start:prod' --name ApiCodechat
91+
pm2 start 'npm run start:prod' --name ApiEvolution
9592
```
9693
## Authentication
9794

@@ -121,7 +118,7 @@ Content-Type: application/json
121118
apikey: t8OOEeISKzpmc3jjcMqBWYSaJH2PIxns
122119
123120
{
124-
"instanceName": "codechat"
121+
"instanceName": "evolution"
125122
}
126123
```
127124
##### cURL
@@ -131,15 +128,15 @@ curl --location --request POST 'http://localhost:8080/instance/create' \
131128
--header 'Content-Type: application/json' \
132129
--header 'apikey: t8OOEeISKzpmc3jjcMqBWYSaJH2PIxns' \
133130
--data-raw '{
134-
"instanceName": "codechat"
131+
"instanceName": "evolution"
135132
}'
136133
```
137134
### Response
138135

139136
```ts
140137
{
141138
"instance": {
142-
"instanceName": "codechat",
139+
"instanceName": "evolution",
143140
"status": "created"
144141
},
145142
"hash": {
@@ -155,23 +152,23 @@ curl --location --request POST 'http://localhost:8080/instance/create' \
155152
##### HTTP
156153

157154
```http
158-
GET /instance/connect/codechat HTTP/1.1
155+
GET /instance/connect/evolution HTTP/1.1
159156
Host: localhost:8080
160157
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9. [...]
161158
```
162159
```http
163-
GET /instance/connect/codechat HTTP/1.1
160+
GET /instance/connect/evolution HTTP/1.1
164161
Host: localhost:8080
165162
apikey: 88513847-1B0E-4188-8D76-4A2750C9B6C3
166163
```
167164
##### cURL
168165

169166
```bash
170-
curl --location --request GET 'http://localhost:8080/instance/connect/codechat' \
167+
curl --location --request GET 'http://localhost:8080/instance/connect/evolution' \
171168
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9. [...]'
172169
```
173170
```bash
174-
curl --location --request GET 'http://localhost:8080/instance/connect/codechat' \
171+
curl --location --request GET 'http://localhost:8080/instance/connect/evolution' \
175172
--header 'apikey: 88513847-1B0E-4188-8D76-4A2750C9B6C3'
176173
```
177174

@@ -188,7 +185,7 @@ curl --location --request GET 'http://localhost:8080/instance/connect/codechat'
188185
- [docker run](./docker.sh)
189186
- [docker-compose](./docker-compose.yml)
190187
- [env for docker](./Docker/.env)
191-
- [DockerHub-codechat/api](https://hub.docker.com/r/codechat/api)
188+
- [DockerHub Evolution API](https://hub.docker.com/repository/docker/davidsongomes/evolution-api)
192189

193190
After building the application, in the same directory as the files above, run the following command:
194191
```sh
@@ -198,17 +195,17 @@ docker-compose up
198195
| | |
199196
|-----|---|
200197
| Send Text ||
201-
| Send Buttons ||
202198
| Send Template ||
203199
| Send Media: audio - video - image - document - gif <br></br>base64: ```true``` ||
204200
| Send Media File ||
205201
| Send Audio type WhatsApp ||
206202
| Send Location ||
207-
| Send List ||
208203
| Send Link Preview ||
209204
| Send Contact ||
210205
| Send Reaction - emoji ||
211206
| Send Poll Message ||
207+
| Send Buttons (Deprecated) ||
208+
| Send List (Deprecated) ||
212209

213210
## Postman collections
214211
- [Postman Json](./postman.json)
@@ -236,6 +233,33 @@ docker-compose up
236233
| GROUP_PARTICIPANTS_UPDATE | group-participants.update | JSON | Notifies when an action occurs involving a participant</br>'add' | 'remove' | 'promote' | 'demote' |
237234
| NEW_TOKEN | new.jwt | JSON | Notifies when the token (jwt) is updated
238235

236+
## Webhook Routes
237+
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.
238+
<br><br>
239+
Example:
240+
241+
https://sub.domain.com/webhook-test/exclusive-webhook-code/qrcode-updated
242+
243+
| Name | Path |
244+
|------|-------|
245+
| APPLICATION_STARTUP | /application-startup |
246+
| QRCODE_UPDATED | /qrcode-updated |
247+
| CONNECTION_UPDATE | /connection-update |
248+
| MESSAGES_SET | /messages-set |
249+
| MESSAGES_UPSERT | /messages-upsert |
250+
| MESSAGES_UPDATE | /messages-update |
251+
| SEND_MESSAGE | /send-message |
252+
| CONTACTS_SET | /contacts-set |
253+
| CONTACTS_UPSERT | /contacts-upsert |
254+
| CONTACTS_UPDATE | /contacts-update |
255+
| PRESENCE_UPDATE | /presence-update |
256+
| CHATS_SET | /chats-set |
257+
| CHATS_UPDATE | /chats-update |
258+
| CHATS_UPSERT | /chats-upsert |
259+
| GROUPS_UPSERT | /groups-upsert |
260+
| GROUPS_UPDATE | /groups-update |
261+
| GROUP_PARTICIPANTS_UPDATE | /groups-participants-update |
262+
| NEW_TOKEN | /new-token |
239263
## Env File
240264

241265
See additional settings that can be applied through the **env** file by clicking **[here](./src/dev-env.yml)**.
@@ -254,8 +278,6 @@ This code was produced based on the baileys library and it is still under develo
254278

255279
# Donate to the project.
256280

257-
#### Pix: 2b526ada-4ef4-4db4-bbeb-f60da2421fce
258-
259281
#### PicPay
260282

261283
<div align="center">

0 commit comments

Comments
 (0)