usofn8n commited on
Commit
b50f61a
·
1 Parent(s): 80f4e3d

Add Evolution API files

Browse files
.dockerignore ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ .git
2
+ *Dockerfile*
3
+ *docker-compose*
4
+ .env
5
+ node_modules
6
+ dist
.env.example ADDED
@@ -0,0 +1,403 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ SERVER_NAME=evolution
2
+ SERVER_TYPE=http
3
+ SERVER_PORT=8080
4
+ # Server URL - Set your application url
5
+ SERVER_URL=http://localhost:8080
6
+
7
+ SSL_CONF_PRIVKEY=/path/to/cert.key
8
+ SSL_CONF_FULLCHAIN=/path/to/cert.crt
9
+
10
+ SENTRY_DSN=
11
+
12
+ # Telemetry - Set to false to disable telemetry
13
+ TELEMETRY_ENABLED=true
14
+ TELEMETRY_URL=
15
+
16
+ # Prometheus metrics - Set to true to enable Prometheus metrics
17
+ PROMETHEUS_METRICS=false
18
+ METRICS_AUTH_REQUIRED=true
19
+ METRICS_USER=prometheus
20
+ METRICS_PASSWORD=secure_random_password_here
21
+ METRICS_ALLOWED_IPS=127.0.0.1,10.0.0.100,192.168.1.50
22
+
23
+ # Proxy configuration (optional)
24
+ PROXY_HOST=
25
+ PROXY_PORT=
26
+ PROXY_PROTOCOL=
27
+ PROXY_USERNAME=
28
+ PROXY_PASSWORD=
29
+
30
+ # Audio converter API (optional)
31
+ API_AUDIO_CONVERTER=
32
+ API_AUDIO_CONVERTER_KEY=
33
+
34
+ # Cors - * for all or set separate by commas - ex.: 'yourdomain1.com, yourdomain2.com'
35
+ CORS_ORIGIN=*
36
+ CORS_METHODS=GET,POST,PUT,DELETE
37
+ CORS_CREDENTIALS=true
38
+
39
+ # Determine the logs to be displayed
40
+ LOG_LEVEL=ERROR,WARN,DEBUG,INFO,LOG,VERBOSE,DARK,WEBHOOKS,WEBSOCKET
41
+ LOG_COLOR=true
42
+ # Log Baileys - "fatal" | "error" | "warn" | "info" | "debug" | "trace"
43
+ LOG_BAILEYS=error
44
+
45
+ # Set the maximum number of listeners that can be registered for an event
46
+ EVENT_EMITTER_MAX_LISTENERS=50
47
+
48
+ # Determine how long the instance should be deleted from memory in case of no connection.
49
+ # Default time: 5 minutes
50
+ # If you don't even want an expiration, enter the value false
51
+ DEL_INSTANCE=false
52
+
53
+ # Provider: postgresql | mysql | psql_bouncer
54
+ DATABASE_PROVIDER=postgresql
55
+ DATABASE_CONNECTION_URI='postgresql://user:pass@postgres:5432/evolution_db?schema=evolution_api'
56
+ # Client name for the database connection
57
+ # It is used to separate an API installation from another that uses the same database.
58
+ DATABASE_CONNECTION_CLIENT_NAME=evolution_exchange
59
+
60
+ # Bouncer connection: used only when the database provider is set to 'psql_bouncer'.
61
+ # Defines the PostgreSQL URL with pgbouncer enabled (pgbouncer=true).
62
+ # DATABASE_BOUNCER_CONNECTION_URI=postgresql://user:pass@pgbouncer:5432/evolution_db?pgbouncer=true&schema=evolution_api
63
+
64
+ # Choose the data you want to save in the application's database
65
+ DATABASE_SAVE_DATA_INSTANCE=true
66
+ DATABASE_SAVE_DATA_NEW_MESSAGE=true
67
+ DATABASE_SAVE_MESSAGE_UPDATE=true
68
+ DATABASE_SAVE_DATA_CONTACTS=true
69
+ DATABASE_SAVE_DATA_CHATS=true
70
+ DATABASE_SAVE_DATA_LABELS=true
71
+ DATABASE_SAVE_DATA_HISTORIC=true
72
+ DATABASE_SAVE_IS_ON_WHATSAPP=true
73
+ DATABASE_SAVE_IS_ON_WHATSAPP_DAYS=7
74
+ DATABASE_DELETE_MESSAGE=true
75
+
76
+ # RabbitMQ - Environment variables
77
+ RABBITMQ_ENABLED=false
78
+ RABBITMQ_URI=amqp://localhost
79
+ RABBITMQ_EXCHANGE_NAME=evolution
80
+ RABBITMQ_FRAME_MAX=8192
81
+ # Global events - By enabling this variable, events from all instances are sent in the same event queue.
82
+ RABBITMQ_GLOBAL_ENABLED=false
83
+ # Prefix key to queue name
84
+ RABBITMQ_PREFIX_KEY=evolution
85
+ # Choose the events you want to send to RabbitMQ
86
+ RABBITMQ_EVENTS_APPLICATION_STARTUP=false
87
+ RABBITMQ_EVENTS_INSTANCE_CREATE=false
88
+ RABBITMQ_EVENTS_INSTANCE_DELETE=false
89
+ RABBITMQ_EVENTS_QRCODE_UPDATED=false
90
+ RABBITMQ_EVENTS_MESSAGES_SET=false
91
+ RABBITMQ_EVENTS_MESSAGES_UPSERT=false
92
+ RABBITMQ_EVENTS_MESSAGES_EDITED=false
93
+ RABBITMQ_EVENTS_MESSAGES_UPDATE=false
94
+ RABBITMQ_EVENTS_MESSAGES_DELETE=false
95
+ RABBITMQ_EVENTS_SEND_MESSAGE=false
96
+ RABBITMQ_EVENTS_SEND_MESSAGE_UPDATE=false
97
+ RABBITMQ_EVENTS_CONTACTS_SET=false
98
+ RABBITMQ_EVENTS_CONTACTS_UPSERT=false
99
+ RABBITMQ_EVENTS_CONTACTS_UPDATE=false
100
+ RABBITMQ_EVENTS_PRESENCE_UPDATE=false
101
+ RABBITMQ_EVENTS_CHATS_SET=false
102
+ RABBITMQ_EVENTS_CHATS_UPSERT=false
103
+ RABBITMQ_EVENTS_CHATS_UPDATE=false
104
+ RABBITMQ_EVENTS_CHATS_DELETE=false
105
+ RABBITMQ_EVENTS_GROUPS_UPSERT=false
106
+ RABBITMQ_EVENTS_GROUP_UPDATE=false
107
+ RABBITMQ_EVENTS_GROUP_PARTICIPANTS_UPDATE=false
108
+ RABBITMQ_EVENTS_CONNECTION_UPDATE=false
109
+ RABBITMQ_EVENTS_REMOVE_INSTANCE=false
110
+ RABBITMQ_EVENTS_LOGOUT_INSTANCE=false
111
+ RABBITMQ_EVENTS_CALL=false
112
+ RABBITMQ_EVENTS_TYPEBOT_START=false
113
+ RABBITMQ_EVENTS_TYPEBOT_CHANGE_STATUS=false
114
+
115
+ # SQS - Environment variables
116
+ SQS_ENABLED=false
117
+ SQS_ACCESS_KEY_ID=
118
+ SQS_SECRET_ACCESS_KEY=
119
+ SQS_ACCOUNT_ID=
120
+ SQS_REGION=
121
+
122
+ SQS_GLOBAL_ENABLED=false
123
+ SQS_GLOBAL_FORCE_SINGLE_QUEUE=false
124
+ SQS_GLOBAL_APPLICATION_STARTUP=false
125
+ SQS_GLOBAL_CALL=false
126
+ SQS_GLOBAL_CHATS_DELETE=false
127
+ SQS_GLOBAL_CHATS_SET=false
128
+ SQS_GLOBAL_CHATS_UPDATE=false
129
+ SQS_GLOBAL_CHATS_UPSERT=false
130
+ SQS_GLOBAL_CONNECTION_UPDATE=false
131
+ SQS_GLOBAL_CONTACTS_SET=false
132
+ SQS_GLOBAL_CONTACTS_UPDATE=false
133
+ SQS_GLOBAL_CONTACTS_UPSERT=false
134
+ SQS_GLOBAL_GROUP_PARTICIPANTS_UPDATE=false
135
+ SQS_GLOBAL_GROUPS_UPDATE=false
136
+ SQS_GLOBAL_GROUPS_UPSERT=false
137
+ SQS_GLOBAL_LABELS_ASSOCIATION=false
138
+ SQS_GLOBAL_LABELS_EDIT=false
139
+ SQS_GLOBAL_LOGOUT_INSTANCE=false
140
+ SQS_GLOBAL_MESSAGES_DELETE=false
141
+ SQS_GLOBAL_MESSAGES_EDITED=false
142
+ SQS_GLOBAL_MESSAGES_SET=false
143
+ SQS_GLOBAL_MESSAGES_UPDATE=false
144
+ SQS_GLOBAL_MESSAGES_UPSERT=false
145
+ SQS_GLOBAL_PRESENCE_UPDATE=false
146
+ SQS_GLOBAL_QRCODE_UPDATED=false
147
+ SQS_GLOBAL_REMOVE_INSTANCE=false
148
+ SQS_GLOBAL_SEND_MESSAGE=false
149
+ SQS_GLOBAL_TYPEBOT_CHANGE_STATUS=false
150
+ SQS_GLOBAL_TYPEBOT_START=false
151
+
152
+ # Websocket - Environment variables
153
+ WEBSOCKET_ENABLED=false
154
+ WEBSOCKET_GLOBAL_EVENTS=false
155
+ WEBSOCKET_ALLOWED_HOSTS=127.0.0.1,::1,::ffff:127.0.0.1
156
+
157
+ # Pusher - Environment variables
158
+ PUSHER_ENABLED=false
159
+ PUSHER_GLOBAL_ENABLED=false
160
+ PUSHER_GLOBAL_APP_ID=
161
+ PUSHER_GLOBAL_KEY=
162
+ PUSHER_GLOBAL_SECRET=
163
+ PUSHER_GLOBAL_CLUSTER=
164
+ PUSHER_GLOBAL_USE_TLS=true
165
+ # Choose the events you want to send to Pusher
166
+ PUSHER_EVENTS_APPLICATION_STARTUP=true
167
+ PUSHER_EVENTS_QRCODE_UPDATED=true
168
+ PUSHER_EVENTS_MESSAGES_SET=true
169
+ PUSHER_EVENTS_MESSAGES_UPSERT=true
170
+ PUSHER_EVENTS_MESSAGES_EDITED=true
171
+ PUSHER_EVENTS_MESSAGES_UPDATE=true
172
+ PUSHER_EVENTS_MESSAGES_DELETE=true
173
+ PUSHER_EVENTS_SEND_MESSAGE=true
174
+ PUSHER_EVENTS_SEND_MESSAGE_UPDATE=true
175
+ PUSHER_EVENTS_CONTACTS_SET=true
176
+ PUSHER_EVENTS_CONTACTS_UPSERT=true
177
+ PUSHER_EVENTS_CONTACTS_UPDATE=true
178
+ PUSHER_EVENTS_PRESENCE_UPDATE=true
179
+ PUSHER_EVENTS_CHATS_SET=true
180
+ PUSHER_EVENTS_CHATS_UPSERT=true
181
+ PUSHER_EVENTS_CHATS_UPDATE=true
182
+ PUSHER_EVENTS_CHATS_DELETE=true
183
+ PUSHER_EVENTS_GROUPS_UPSERT=true
184
+ PUSHER_EVENTS_GROUPS_UPDATE=true
185
+ PUSHER_EVENTS_GROUP_PARTICIPANTS_UPDATE=true
186
+ PUSHER_EVENTS_CONNECTION_UPDATE=true
187
+ PUSHER_EVENTS_LABELS_EDIT=true
188
+ PUSHER_EVENTS_LABELS_ASSOCIATION=true
189
+ PUSHER_EVENTS_CALL=true
190
+ PUSHER_EVENTS_TYPEBOT_START=false
191
+ PUSHER_EVENTS_TYPEBOT_CHANGE_STATUS=false
192
+
193
+ # Kafka - Environment variables
194
+ KAFKA_ENABLED=false
195
+ KAFKA_CLIENT_ID=evolution-api
196
+ KAFKA_BROKERS=localhost:9092
197
+ KAFKA_CONNECTION_TIMEOUT=3000
198
+ KAFKA_REQUEST_TIMEOUT=30000
199
+ # Global events - By enabling this variable, events from all instances are sent to global Kafka topics.
200
+ KAFKA_GLOBAL_ENABLED=false
201
+ KAFKA_CONSUMER_GROUP_ID=evolution-api-consumers
202
+ KAFKA_TOPIC_PREFIX=evolution
203
+ KAFKA_NUM_PARTITIONS=1
204
+ KAFKA_REPLICATION_FACTOR=1
205
+ KAFKA_AUTO_CREATE_TOPICS=false
206
+ # Choose the events you want to send to Kafka
207
+ KAFKA_EVENTS_APPLICATION_STARTUP=false
208
+ KAFKA_EVENTS_INSTANCE_CREATE=false
209
+ KAFKA_EVENTS_INSTANCE_DELETE=false
210
+ KAFKA_EVENTS_QRCODE_UPDATED=false
211
+ KAFKA_EVENTS_MESSAGES_SET=false
212
+ KAFKA_EVENTS_MESSAGES_UPSERT=false
213
+ KAFKA_EVENTS_MESSAGES_EDITED=false
214
+ KAFKA_EVENTS_MESSAGES_UPDATE=false
215
+ KAFKA_EVENTS_MESSAGES_DELETE=false
216
+ KAFKA_EVENTS_SEND_MESSAGE=false
217
+ KAFKA_EVENTS_SEND_MESSAGE_UPDATE=false
218
+ KAFKA_EVENTS_CONTACTS_SET=false
219
+ KAFKA_EVENTS_CONTACTS_UPSERT=false
220
+ KAFKA_EVENTS_CONTACTS_UPDATE=false
221
+ KAFKA_EVENTS_PRESENCE_UPDATE=false
222
+ KAFKA_EVENTS_CHATS_SET=false
223
+ KAFKA_EVENTS_CHATS_UPSERT=false
224
+ KAFKA_EVENTS_CHATS_UPDATE=false
225
+ KAFKA_EVENTS_CHATS_DELETE=false
226
+ KAFKA_EVENTS_GROUPS_UPSERT=false
227
+ KAFKA_EVENTS_GROUPS_UPDATE=false
228
+ KAFKA_EVENTS_GROUP_PARTICIPANTS_UPDATE=false
229
+ KAFKA_EVENTS_CONNECTION_UPDATE=false
230
+ KAFKA_EVENTS_LABELS_EDIT=false
231
+ KAFKA_EVENTS_LABELS_ASSOCIATION=false
232
+ KAFKA_EVENTS_CALL=false
233
+ KAFKA_EVENTS_TYPEBOT_START=false
234
+ KAFKA_EVENTS_TYPEBOT_CHANGE_STATUS=false
235
+ # SASL Authentication (optional)
236
+ KAFKA_SASL_ENABLED=false
237
+ KAFKA_SASL_MECHANISM=plain
238
+ KAFKA_SASL_USERNAME=
239
+ KAFKA_SASL_PASSWORD=
240
+ # SSL Configuration (optional)
241
+ KAFKA_SSL_ENABLED=false
242
+ KAFKA_SSL_REJECT_UNAUTHORIZED=true
243
+ KAFKA_SSL_CA=
244
+ KAFKA_SSL_KEY=
245
+ KAFKA_SSL_CERT=
246
+
247
+ # WhatsApp Business API - Environment variables
248
+ # Token used to validate the webhook on the Facebook APP
249
+ WA_BUSINESS_TOKEN_WEBHOOK=evolution
250
+ WA_BUSINESS_URL=https://graph.facebook.com
251
+ WA_BUSINESS_VERSION=v20.0
252
+ WA_BUSINESS_LANGUAGE=en_US
253
+
254
+ # Global Webhook Settings
255
+ # Each instance's Webhook URL and events will be requested at the time it is created
256
+ WEBHOOK_GLOBAL_ENABLED=false
257
+ # Define a global webhook that will listen for enabled events from all instances
258
+ WEBHOOK_GLOBAL_URL=''
259
+ # With this option activated, you work with a url per webhook event, respecting the global url and the name of each event
260
+ WEBHOOK_GLOBAL_WEBHOOK_BY_EVENTS=false
261
+ # Set the events you want to hear
262
+ WEBHOOK_EVENTS_APPLICATION_STARTUP=false
263
+ WEBHOOK_EVENTS_QRCODE_UPDATED=true
264
+ WEBHOOK_EVENTS_MESSAGES_SET=true
265
+ WEBHOOK_EVENTS_MESSAGES_UPSERT=true
266
+ WEBHOOK_EVENTS_MESSAGES_EDITED=true
267
+ WEBHOOK_EVENTS_MESSAGES_UPDATE=true
268
+ WEBHOOK_EVENTS_MESSAGES_DELETE=true
269
+ WEBHOOK_EVENTS_SEND_MESSAGE=true
270
+ WEBHOOK_EVENTS_SEND_MESSAGE_UPDATE=true
271
+ WEBHOOK_EVENTS_CONTACTS_SET=true
272
+ WEBHOOK_EVENTS_CONTACTS_UPSERT=true
273
+ WEBHOOK_EVENTS_CONTACTS_UPDATE=true
274
+ WEBHOOK_EVENTS_PRESENCE_UPDATE=true
275
+ WEBHOOK_EVENTS_CHATS_SET=true
276
+ WEBHOOK_EVENTS_CHATS_UPSERT=true
277
+ WEBHOOK_EVENTS_CHATS_UPDATE=true
278
+ WEBHOOK_EVENTS_CHATS_DELETE=true
279
+ WEBHOOK_EVENTS_GROUPS_UPSERT=true
280
+ WEBHOOK_EVENTS_GROUPS_UPDATE=true
281
+ WEBHOOK_EVENTS_GROUP_PARTICIPANTS_UPDATE=true
282
+ WEBHOOK_EVENTS_CONNECTION_UPDATE=true
283
+ WEBHOOK_EVENTS_REMOVE_INSTANCE=false
284
+ WEBHOOK_EVENTS_LOGOUT_INSTANCE=false
285
+ WEBHOOK_EVENTS_LABELS_EDIT=true
286
+ WEBHOOK_EVENTS_LABELS_ASSOCIATION=true
287
+ WEBHOOK_EVENTS_CALL=true
288
+ # This events is used with Typebot
289
+ WEBHOOK_EVENTS_TYPEBOT_START=false
290
+ WEBHOOK_EVENTS_TYPEBOT_CHANGE_STATUS=false
291
+ # This event is used to send errors
292
+ WEBHOOK_EVENTS_ERRORS=false
293
+ WEBHOOK_EVENTS_ERRORS_WEBHOOK=
294
+
295
+ WEBHOOK_REQUEST_TIMEOUT_MS=60000
296
+ WEBHOOK_RETRY_MAX_ATTEMPTS=10
297
+ WEBHOOK_RETRY_INITIAL_DELAY_SECONDS=5
298
+ WEBHOOK_RETRY_USE_EXPONENTIAL_BACKOFF=true
299
+ WEBHOOK_RETRY_MAX_DELAY_SECONDS=300
300
+ WEBHOOK_RETRY_JITTER_FACTOR=0.2
301
+ # Comma separated list of HTTP status codes that should not trigger retries
302
+ WEBHOOK_RETRY_NON_RETRYABLE_STATUS_CODES=400,401,403,404,422
303
+
304
+ # Name that will be displayed on smartphone connection
305
+ CONFIG_SESSION_PHONE_CLIENT=Evolution API
306
+ # Browser Name = Chrome | Firefox | Edge | Opera | Safari
307
+ CONFIG_SESSION_PHONE_NAME=Chrome
308
+
309
+ # Whatsapp Web version for baileys channel
310
+ # https://web.whatsapp.com/check-update?version=0&platform=web
311
+
312
+
313
+ # Set qrcode display limit
314
+ QRCODE_LIMIT=30
315
+ # Color of the QRCode on base64
316
+ QRCODE_COLOR='#175197'
317
+
318
+ # Typebot - Environment variables
319
+ TYPEBOT_ENABLED=false
320
+ # old | latest
321
+ TYPEBOT_API_VERSION=latest
322
+
323
+ # Chatwoot - Environment variables
324
+ CHATWOOT_ENABLED=false
325
+ # If you leave this option as false, when deleting the message for everyone on WhatsApp, it will not be deleted on Chatwoot.
326
+ CHATWOOT_MESSAGE_READ=true
327
+ # If you leave this option as true, when sending a message in Chatwoot, the client's last message will be marked as read on WhatsApp.
328
+ CHATWOOT_MESSAGE_DELETE=true
329
+ # If you leave this option as true, a contact will be created on Chatwoot to provide the QR Code and update messages about the instance.
330
+ CHATWOOT_BOT_CONTACT=true
331
+ # This db connection is used to import messages from whatsapp to chatwoot database
332
+ CHATWOOT_IMPORT_DATABASE_CONNECTION_URI=postgresql://user:passwprd@host:5432/chatwoot?sslmode=disable
333
+ CHATWOOT_IMPORT_PLACEHOLDER_MEDIA_MESSAGE=true
334
+
335
+ # OpenAI - Environment variables
336
+ OPENAI_ENABLED=false
337
+
338
+ # Dify - Environment variables
339
+ DIFY_ENABLED=false
340
+
341
+ # n8n - Environment variables
342
+ N8N_ENABLED=false
343
+
344
+ # EvoAI - Environment variables
345
+ EVOAI_ENABLED=false
346
+
347
+ # Cache - Environment variables
348
+ # Redis Cache enabled
349
+ CACHE_REDIS_ENABLED=true
350
+ CACHE_REDIS_URI=redis://localhost:6379/6
351
+ CACHE_REDIS_TTL=604800
352
+ # Prefix serves to differentiate data from one installation to another that are using the same redis
353
+ CACHE_REDIS_PREFIX_KEY=evolution
354
+ # Enabling this variable will save the connection information in Redis and not in the database.
355
+ CACHE_REDIS_SAVE_INSTANCES=false
356
+ # Local Cache enabled
357
+ CACHE_LOCAL_ENABLED=false
358
+
359
+ # Amazon S3 - Environment variables
360
+ S3_ENABLED=false
361
+ S3_ACCESS_KEY=
362
+ S3_SECRET_KEY=
363
+ S3_BUCKET=evolution
364
+ S3_PORT=443
365
+ S3_ENDPOINT=s3.domain.com
366
+ S3_REGION=eu-west-3
367
+ S3_USE_SSL=true
368
+
369
+ # AMAZON S3 - Environment variables
370
+ # S3_ENABLED=true
371
+ # S3_BUCKET=bucket_name
372
+ # S3_ACCESS_KEY=access_key_id
373
+ # S3_SECRET_KEY=secret_access_key
374
+ # S3_ENDPOINT=s3.amazonaws.com # region: s3.eu-west-3.amazonaws.com
375
+ # S3_REGION=eu-west-3
376
+
377
+ # MINIO Use SSL - Environment variables
378
+ # S3_ENABLED=true
379
+ # S3_ACCESS_KEY=access_key_id
380
+ # S3_SECRET_KEY=secret_access_key
381
+ # S3_BUCKET=bucket_name
382
+ # S3_PORT=443
383
+ # S3_ENDPOINT=s3.domain.com
384
+ # S3_USE_SSL=true
385
+ # S3_REGION=eu-south
386
+
387
+ # Evolution Audio Converter - Environment variables - https://github.com/EvolutionAPI/evolution-audio-converter
388
+ # API_AUDIO_CONVERTER=http://localhost:4040/process-audio
389
+ # API_AUDIO_CONVERTER_KEY=429683C4C977415CAAFCCE10F7D57E11
390
+
391
+ # Define a global apikey to access all instances.
392
+ # OBS: This key must be inserted in the request header to create an instance.
393
+ AUTHENTICATION_API_KEY=429683C4C977415CAAFCCE10F7D57E11
394
+ # If you leave this option as true, the instances will be exposed in the fetch instances endpoint.
395
+ AUTHENTICATION_EXPOSE_IN_FETCH_INSTANCES=true
396
+ LANGUAGE=en
397
+
398
+ # Define a global proxy to be used if the instance does not have one
399
+ # PROXY_HOST=
400
+ # PROXY_PORT=80
401
+ # PROXY_PROTOCOL=http
402
+ # PROXY_USERNAME=
403
+ # PROXY_PASSWORD=
.eslintignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ /node-modules
2
+ /dist
.eslintrc.js ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ module.exports = {
2
+ parser: '@typescript-eslint/parser',
3
+ parserOptions: {
4
+ project: 'tsconfig.json',
5
+ tsconfigRootDir: __dirname,
6
+ sourceType: 'module',
7
+ warnOnUnsupportedTypeScriptVersion: false,
8
+ EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true,
9
+ },
10
+ plugins: ['@typescript-eslint', 'simple-import-sort', 'import'],
11
+ extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
12
+ globals: {
13
+ Atomics: 'readonly',
14
+ SharedArrayBuffer: 'readonly',
15
+ },
16
+ root: true,
17
+ env: {
18
+ node: true,
19
+ jest: true,
20
+ },
21
+ ignorePatterns: ['.eslintrc.js'],
22
+ rules: {
23
+ '@typescript-eslint/interface-name-prefix': 'off',
24
+ '@typescript-eslint/explicit-function-return-type': 'off',
25
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
26
+ '@typescript-eslint/no-explicit-any': 'off',
27
+ '@typescript-eslint/no-empty-function': 'off',
28
+ '@typescript-eslint/no-non-null-assertion': 'off',
29
+ '@typescript-eslint/no-unused-vars': 'error',
30
+ 'import/first': 'error',
31
+ 'import/no-duplicates': 'error',
32
+ 'simple-import-sort/imports': 'error',
33
+ 'simple-import-sort/exports': 'error',
34
+ '@typescript-eslint/no-empty-object-type': 'off',
35
+ '@typescript-eslint/no-wrapper-object-types': 'off',
36
+ '@typescript-eslint/no-unused-expressions': 'off',
37
+ 'prettier/prettier': ['error', { endOfLine: 'auto' }],
38
+ },
39
+ };
.gitignore ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Repo
2
+ Baileys
3
+ # compiled output
4
+ /dist
5
+ /node_modules
6
+
7
+ /Docker/.env
8
+
9
+ # Logs
10
+ logs/**.json
11
+ *.log
12
+ npm-debug.log*
13
+ pnpm-debug.log*
14
+ yarn-debug.log*
15
+ yarn-error.log*
16
+ lerna-debug.log*
17
+
18
+ /docker-compose-data
19
+ /docker-data
20
+
21
+ # Package
22
+ /yarn.lock
23
+ /pnpm-lock.yaml
24
+
25
+ # IDEs
26
+ .vscode/*
27
+ !.vscode/settings.json
28
+ !.vscode/tasks.json
29
+ !.vscode/launch.json
30
+ !.vscode/extensions.json
31
+ .nova/*
32
+ .idea/*
33
+
34
+ # Project related
35
+ /instances/*
36
+ !/instances/.gitkeep
37
+ /test/
38
+ /src/env.yml
39
+ /store
40
+ *.env
41
+
42
+ /temp/*
43
+
44
+ .DS_Store
45
+ *.DS_Store
46
+ .tool-versions
47
+
48
+ /prisma/migrations/*
.gitmodules ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ [submodule "evolution-manager-v2"]
2
+ path = evolution-manager-v2
3
+ url = https://github.com/EvolutionAPI/evolution-manager-v2.git
.prettierrc.js ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ module.exports = {
2
+ semi: true,
3
+ trailingComma: 'all',
4
+ singleQuote: true,
5
+ printWidth: 120,
6
+ arrowParens: 'always',
7
+ tabWidth: 2,
8
+ useTabs: false,
9
+ bracketSameLine: false,
10
+ bracketSpacing: true,
11
+ parser: 'typescript'
12
+ }
AGENTS.md ADDED
@@ -0,0 +1,355 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Evolution API - AI Agent Guidelines
2
+
3
+ This document provides comprehensive guidelines for AI agents (Claude, GPT, Cursor, etc.) working with the Evolution API codebase.
4
+
5
+ ## Project Overview
6
+
7
+ **Evolution API** is a production-ready, multi-tenant WhatsApp API platform built with Node.js, TypeScript, and Express.js. It supports multiple WhatsApp providers and extensive integrations with chatbots, CRM systems, and messaging platforms.
8
+
9
+ ## Project Structure & Module Organization
10
+
11
+ ### Core Directories
12
+ - **`src/`** – TypeScript source code with modular architecture
13
+ - `api/controllers/` – HTTP route handlers (thin layer)
14
+ - `api/services/` – Business logic (core functionality)
15
+ - `api/routes/` – Express route definitions (RouterBroker pattern)
16
+ - `api/integrations/` – External service integrations
17
+ - `channel/` – WhatsApp providers (Baileys, Business API, Evolution)
18
+ - `chatbot/` – AI/Bot integrations (OpenAI, Dify, Typebot, Chatwoot)
19
+ - `event/` – Event systems (WebSocket, RabbitMQ, SQS, NATS, Pusher)
20
+ - `storage/` – File storage (S3, MinIO)
21
+ - `dto/` – Data Transfer Objects (simple classes, no decorators)
22
+ - `guards/` – Authentication/authorization middleware
23
+ - `types/` – TypeScript type definitions
24
+ - `repository/` – Data access layer (Prisma)
25
+ - **`prisma/`** – Database schemas and migrations
26
+ - `postgresql-schema.prisma` / `mysql-schema.prisma` – Provider-specific schemas
27
+ - `postgresql-migrations/` / `mysql-migrations/` – Provider-specific migrations
28
+ - **`config/`** – Environment and application configuration
29
+ - **`utils/`** – Shared utilities and helper functions
30
+ - **`validate/`** – JSONSchema7 validation schemas
31
+ - **`exceptions/`** – Custom HTTP exception classes
32
+ - **`cache/`** – Redis and local cache implementations
33
+
34
+ ### Build & Deployment
35
+ - **`dist/`** – Build output (do not edit directly)
36
+ - **`public/`** – Static assets and media files
37
+ - **`Docker*`**, **`docker-compose*.yaml`** – Containerization and local development stack
38
+
39
+ ## Build, Test, and Development Commands
40
+
41
+ ### Development Workflow
42
+ ```bash
43
+ # Development server with hot reload
44
+ npm run dev:server
45
+
46
+ # Direct execution for testing
47
+ npm start
48
+
49
+ # Production build and run
50
+ npm run build
51
+ npm run start:prod
52
+ ```
53
+
54
+ ### Code Quality
55
+ ```bash
56
+ # Linting and formatting
57
+ npm run lint # ESLint with auto-fix
58
+ npm run lint:check # ESLint check only
59
+
60
+ # Commit with conventional commits
61
+ npm run commit # Interactive commit with Commitizen
62
+ ```
63
+
64
+ ### Database Management
65
+ ```bash
66
+ # Set database provider first (CRITICAL)
67
+ export DATABASE_PROVIDER=postgresql # or mysql
68
+
69
+ # Generate Prisma client
70
+ npm run db:generate
71
+
72
+ # Development migrations (with provider sync)
73
+ npm run db:migrate:dev # Unix/Mac
74
+ npm run db:migrate:dev:win # Windows
75
+
76
+ # Production deployment
77
+ npm run db:deploy # Unix/Mac
78
+ npm run db:deploy:win # Windows
79
+
80
+ # Database tools
81
+ npm run db:studio # Open Prisma Studio
82
+ ```
83
+
84
+ ### Docker Development
85
+ ```bash
86
+ # Start local services (Redis, PostgreSQL, etc.)
87
+ docker-compose up -d
88
+
89
+ # Full development stack
90
+ docker-compose -f docker-compose.dev.yaml up -d
91
+ ```
92
+
93
+ ## Coding Standards & Architecture Patterns
94
+
95
+ ### Code Style (Enforced by ESLint + Prettier)
96
+ - **TypeScript strict mode** with full type coverage
97
+ - **2-space indentation**, single quotes, trailing commas
98
+ - **120-character line limit**
99
+ - **Import order** via `simple-import-sort`
100
+ - **File naming**: `feature.kind.ts` (e.g., `whatsapp.baileys.service.ts`)
101
+ - **Naming conventions**:
102
+ - Classes: `PascalCase`
103
+ - Functions/variables: `camelCase`
104
+ - Constants: `UPPER_SNAKE_CASE`
105
+ - Files: `kebab-case.type.ts`
106
+
107
+ ### Architecture Patterns
108
+
109
+ #### Service Layer Pattern
110
+ ```typescript
111
+ export class ExampleService {
112
+ constructor(private readonly waMonitor: WAMonitoringService) {}
113
+
114
+ private readonly logger = new Logger('ExampleService');
115
+
116
+ public async create(instance: InstanceDto, data: ExampleDto) {
117
+ // Business logic here
118
+ return { example: { ...instance, data } };
119
+ }
120
+
121
+ public async find(instance: InstanceDto): Promise<ExampleDto | null> {
122
+ try {
123
+ const result = await this.waMonitor.waInstances[instance.instanceName].findData();
124
+ return result || null; // Return null on not found (Evolution pattern)
125
+ } catch (error) {
126
+ this.logger.error('Error finding data:', error);
127
+ return null; // Return null on error (Evolution pattern)
128
+ }
129
+ }
130
+ }
131
+ ```
132
+
133
+ #### Controller Pattern (Thin Layer)
134
+ ```typescript
135
+ export class ExampleController {
136
+ constructor(private readonly exampleService: ExampleService) {}
137
+
138
+ public async createExample(instance: InstanceDto, data: ExampleDto) {
139
+ return this.exampleService.create(instance, data);
140
+ }
141
+ }
142
+ ```
143
+
144
+ #### RouterBroker Pattern
145
+ ```typescript
146
+ export class ExampleRouter extends RouterBroker {
147
+ constructor(...guards: any[]) {
148
+ super();
149
+ this.router.post(this.routerPath('create'), ...guards, async (req, res) => {
150
+ const response = await this.dataValidate<ExampleDto>({
151
+ request: req,
152
+ schema: exampleSchema, // JSONSchema7
153
+ ClassRef: ExampleDto,
154
+ execute: (instance, data) => controller.createExample(instance, data),
155
+ });
156
+ res.status(201).json(response);
157
+ });
158
+ }
159
+ }
160
+ ```
161
+
162
+ #### DTO Pattern (Simple Classes)
163
+ ```typescript
164
+ // CORRECT - Evolution API pattern (no decorators)
165
+ export class ExampleDto {
166
+ name: string;
167
+ description?: string;
168
+ enabled: boolean;
169
+ }
170
+
171
+ // INCORRECT - Don't use class-validator decorators
172
+ export class BadExampleDto {
173
+ @IsString() // ❌ Evolution API doesn't use decorators
174
+ name: string;
175
+ }
176
+ ```
177
+
178
+ #### Validation Pattern (JSONSchema7)
179
+ ```typescript
180
+ import { JSONSchema7 } from 'json-schema';
181
+ import { v4 } from 'uuid';
182
+
183
+ export const exampleSchema: JSONSchema7 = {
184
+ $id: v4(),
185
+ type: 'object',
186
+ properties: {
187
+ name: { type: 'string' },
188
+ description: { type: 'string' },
189
+ enabled: { type: 'boolean' },
190
+ },
191
+ required: ['name', 'enabled'],
192
+ };
193
+ ```
194
+
195
+ ## Multi-Tenant Architecture
196
+
197
+ ### Instance Isolation
198
+ - **CRITICAL**: All operations must be scoped by `instanceName` or `instanceId`
199
+ - **Database queries**: Always include `where: { instanceId: ... }`
200
+ - **Authentication**: Validate instance ownership before operations
201
+ - **Data isolation**: Complete separation between tenant instances
202
+
203
+ ### WhatsApp Instance Management
204
+ ```typescript
205
+ // Access instance via WAMonitoringService
206
+ const waInstance = this.waMonitor.waInstances[instance.instanceName];
207
+ if (!waInstance) {
208
+ throw new NotFoundException(`Instance ${instance.instanceName} not found`);
209
+ }
210
+ ```
211
+
212
+ ## Database Patterns
213
+
214
+ ### Multi-Provider Support
215
+ - **PostgreSQL**: Uses `@db.Integer`, `@db.JsonB`, `@default(now())`
216
+ - **MySQL**: Uses `@db.Int`, `@db.Json`, `@default(now())`
217
+ - **Environment**: Set `DATABASE_PROVIDER=postgresql` or `mysql`
218
+ - **Migrations**: Provider-specific folders auto-selected
219
+
220
+ ### Prisma Repository Pattern
221
+ ```typescript
222
+ // Always use PrismaRepository for database operations
223
+ const result = await this.prismaRepository.instance.findUnique({
224
+ where: { name: instanceName },
225
+ });
226
+ ```
227
+
228
+ ## Integration Patterns
229
+
230
+ ### Channel Integration (WhatsApp Providers)
231
+ - **Baileys**: WhatsApp Web with QR code authentication
232
+ - **Business API**: Official Meta WhatsApp Business API
233
+ - **Evolution API**: Custom WhatsApp integration
234
+ - **Pattern**: Extend base channel service classes
235
+
236
+ ### Chatbot Integration
237
+ - **Base classes**: Extend `BaseChatbotService` and `BaseChatbotController`
238
+ - **Trigger system**: Support keyword, regex, and advanced triggers
239
+ - **Session management**: Handle conversation state per user
240
+ - **Available integrations**: EvolutionBot, OpenAI, Dify, Typebot, Chatwoot, Flowise, N8N, EvoAI
241
+
242
+ ### Event Integration
243
+ - **Internal events**: EventEmitter2 for application events
244
+ - **External events**: WebSocket, RabbitMQ, SQS, NATS, Pusher
245
+ - **Webhook delivery**: Reliable delivery with retry logic
246
+
247
+ ## Testing Guidelines
248
+
249
+ ### Current State
250
+ - **No formal test suite** currently implemented
251
+ - **Manual testing** is the primary approach
252
+ - **Integration testing** in development environment
253
+
254
+ ### Testing Strategy
255
+ ```typescript
256
+ // Place tests in test/ directory as *.test.ts
257
+ // Run: npm test (watches test/all.test.ts)
258
+
259
+ describe('ExampleService', () => {
260
+ it('should create example', async () => {
261
+ // Mock external dependencies
262
+ // Test business logic
263
+ // Assert expected behavior
264
+ });
265
+ });
266
+ ```
267
+
268
+ ### Recommended Approach
269
+ - Focus on **critical business logic** in services
270
+ - **Mock external dependencies** (WhatsApp APIs, databases)
271
+ - **Integration tests** for API endpoints
272
+ - **Manual testing** for WhatsApp connection flows
273
+
274
+ ## Commit & Pull Request Guidelines
275
+
276
+ ### Conventional Commits (Enforced by commitlint)
277
+ ```bash
278
+ # Use interactive commit tool
279
+ npm run commit
280
+
281
+ # Commit format: type(scope): subject (max 100 chars)
282
+ # Types: feat, fix, docs, style, refactor, perf, test, chore, ci, build, revert, security
283
+ ```
284
+
285
+ ### Examples
286
+ - `feat(api): add WhatsApp message status endpoint`
287
+ - `fix(baileys): resolve connection timeout issue`
288
+ - `docs(readme): update installation instructions`
289
+ - `refactor(service): extract common message validation logic`
290
+
291
+ ### Pull Request Requirements
292
+ - **Clear description** of changes and motivation
293
+ - **Linked issues** if applicable
294
+ - **Migration impact** (specify database provider)
295
+ - **Local testing steps** with screenshots/logs
296
+ - **Breaking changes** clearly documented
297
+
298
+ ## Security & Configuration
299
+
300
+ ### Environment Setup
301
+ ```bash
302
+ # Copy example environment file
303
+ cp .env.example .env
304
+
305
+ # NEVER commit secrets to version control
306
+ # Set DATABASE_PROVIDER before database commands
307
+ export DATABASE_PROVIDER=postgresql # or mysql
308
+ ```
309
+
310
+ ### Security Best Practices
311
+ - **API key authentication** via `apikey` header
312
+ - **Input validation** with JSONSchema7
313
+ - **Rate limiting** on all endpoints
314
+ - **Webhook signature validation**
315
+ - **Instance-based access control**
316
+ - **Secure defaults** for all configurations
317
+
318
+ ### Vulnerability Reporting
319
+ - See `SECURITY.md` for security vulnerability reporting process
320
+ - Contact: `contato@evolution-api.com`
321
+
322
+ ## Communication Standards
323
+
324
+ ### Language Requirements
325
+ - **User communication**: Always respond in Portuguese (PT-BR)
326
+ - **Code/comments**: English for technical documentation
327
+ - **API responses**: English for consistency
328
+ - **Error messages**: Portuguese for user-facing errors
329
+
330
+ ### Documentation Standards
331
+ - **Inline comments**: Document complex business logic
332
+ - **API documentation**: Document all public endpoints
333
+ - **Integration guides**: Document new integration patterns
334
+ - **Migration guides**: Document database schema changes
335
+
336
+ ## Performance & Scalability
337
+
338
+ ### Caching Strategy
339
+ - **Redis primary**: Distributed caching for production
340
+ - **Node-cache fallback**: Local caching when Redis unavailable
341
+ - **TTL strategy**: Appropriate cache expiration per data type
342
+ - **Cache invalidation**: Proper invalidation on data changes
343
+
344
+ ### Connection Management
345
+ - **Database**: Prisma connection pooling
346
+ - **WhatsApp**: One connection per instance with lifecycle management
347
+ - **Redis**: Connection pooling and retry logic
348
+ - **External APIs**: Rate limiting and retry with exponential backoff
349
+
350
+ ### Monitoring & Observability
351
+ - **Structured logging**: Pino logger with correlation IDs
352
+ - **Error tracking**: Comprehensive error scenarios
353
+ - **Health checks**: Instance status and connection monitoring
354
+ - **Telemetry**: Usage analytics (non-sensitive data only)
355
+
CHANGELOG.md ADDED
@@ -0,0 +1,1170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 2.3.6 (2025-10-21)
2
+
3
+ ### Features
4
+
5
+ * **Baileys, Chatwoot, OnWhatsapp Cache**: Multiple implementations and fixes
6
+ - Fixed cache for PN, LID and g.us numbers to send correct number
7
+ - Fixed audio and document sending via Chatwoot in Baileys channel
8
+ - Multiple fixes in Chatwoot integration
9
+ - Fixed ignored messages when receiving leads
10
+
11
+ ### Fixed
12
+
13
+ * **Baileys**: Fix buffer storage in database
14
+ - Correctly save Uint8Array values to database
15
+ * **Baileys**: Simplify logging of messageSent object
16
+ - Fixed "this.isZero not is function" error
17
+
18
+ ### Chore
19
+
20
+ * **Version**: Bump version to 2.3.6 and update Baileys dependency to 7.0.0-rc.6
21
+ * **Workflows**: Update checkout step to include submodules
22
+ - Added 'submodules: recursive' option to checkout step in multiple workflow files to ensure submodules are properly initialized during CI/CD processes
23
+ * **Manager**: Update asset files and install process
24
+ - Updated subproject reference in evolution-manager-v2 to the latest commit
25
+ - Enhanced the manager_install.sh script to include npm install and build steps
26
+ - Replaced old JavaScript asset file with a new version for improved performance
27
+ - Added a new CSS file for consistent styling across the application
28
+
29
+ # 2.3.5 (2025-10-15)
30
+
31
+ ### Features
32
+
33
+ * **Chatwoot Enhancements**: Comprehensive improvements to message handling, editing, deletion and i18n
34
+ * **Participants Data**: Add participantsData field maintaining backward compatibility for group participants
35
+ * **LID to Phone Number**: Convert LID to phoneNumber on group participants
36
+ * **Docker Configurations**: Add Kafka and frontend services to Docker configurations
37
+
38
+ ### Fixed
39
+
40
+ * **Kafka Migration**: Fixed PostgreSQL migration error for Kafka integration
41
+ - Corrected table reference from `"public"."Instance"` to `"Instance"` in foreign key constraint
42
+ - Fixed `ERROR: relation "public.Instance" does not exist` issue in migration `20250918182355_add_kafka_integration`
43
+ - Aligned table naming convention with other Evolution API migrations for consistency
44
+ - Resolved database migration failure that prevented Kafka integration setup
45
+ * **Update Baileys Version**: v7.0.0-rc.5 with compatibility fixes
46
+ - Fixed assertSessions signature compatibility using type assertion
47
+ - Fixed incompatibility in voice call (wavoip) with new Baileys version
48
+ - Handle undefined status in update by defaulting to 'DELETED'
49
+ * **Chatwoot Improvements**: Multiple fixes for enhanced reliability
50
+ - Correct chatId extraction for non-group JIDs
51
+ - Resolve webhook timeout on deletion with 5+ images
52
+ - Improve error handling in Chatwoot messages
53
+ - Adjust conversation verification logic and cache
54
+ - Optimize conversation reopening logic and connection notification
55
+ - Fix conversation reopening and connection loop
56
+ * **Baileys Message Handling**: Enhanced message processing
57
+ - Add warning log for messages not found
58
+ - Fix message verification in Baileys service
59
+ - Simplify linkPreview handling in BaileysStartupService
60
+ * **Media Validation**: Fix media content validation
61
+ * **PostgreSQL Connection**: Refactor connection with PostgreSQL and improve message handling
62
+
63
+ ### Code Quality & Refactoring
64
+
65
+ * **Exponential Backoff**: Implement exponential backoff patterns and extract magic numbers to constants
66
+ * **TypeScript Build**: Update TypeScript build process and dependencies
67
+
68
+ ###
69
+
70
+ # 2.3.4 (2025-09-23)
71
+
72
+ ### Features
73
+
74
+ * **Kafka Integration**: Added Apache Kafka event integration for real-time event streaming
75
+ - New Kafka controller, router, and schema for event publishing
76
+ - Support for instance-specific and global event topics
77
+ - Configurable SASL/SSL authentication and connection settings
78
+ - Auto-creation of topics with configurable partitions and replication
79
+ - Consumer group management for reliable event processing
80
+ - Integration with existing event manager for seamless event distribution
81
+
82
+ * **Evolution Manager v2 Open Source**: Evolution Manager v2 is now available as open source
83
+ - Added as git submodule with HTTPS URL for easy access
84
+ - Complete open source setup with Apache 2.0 license + Evolution API custom conditions
85
+ - GitHub templates for issues, pull requests, and workflows
86
+ - Comprehensive documentation and contribution guidelines
87
+ - Docker support for development and production environments
88
+ - CI/CD workflows for code quality, security audits, and automated builds
89
+ - Multi-language support (English, Portuguese, Spanish, French)
90
+ - Modern React + TypeScript + Vite frontend with Tailwind CSS
91
+
92
+ * **EvolutionBot Enhancements**: Improved EvolutionBot functionality and message handling
93
+ - Implemented splitMessages functionality for better message segmentation
94
+ - Added linkPreview support for enhanced message presentation
95
+ - Centralized split logic across chatbot services for consistency
96
+ - Enhanced message formatting and delivery capabilities
97
+
98
+ ### Fixed
99
+
100
+ * **MySQL Schema**: Fixed invalid default value errors for `createdAt` fields in `Evoai` and `EvoaiSetting` models
101
+ - Changed `@default(now())` to `@default(dbgenerated("CURRENT_TIMESTAMP"))` for MySQL compatibility
102
+ - Added missing relation fields (`N8n`, `N8nSetting`, `Evoai`, `EvoaiSetting`) in Instance model
103
+ - Resolved Prisma schema validation errors for MySQL provider
104
+
105
+ * **Prisma Schema Validation**: Fixed `instanceName` field error in message creation
106
+ - Removed invalid `instanceName` field from message objects before database insertion
107
+ - Resolved `Unknown argument 'instanceName'` Prisma validation error
108
+ - Streamlined message data structure to match Prisma schema requirements
109
+
110
+ * **Media Message Processing**: Enhanced media handling across chatbot services
111
+ - Fixed base64 conversion in EvoAI service for proper image processing
112
+ - Converted ArrayBuffer to base64 string using `Buffer.from().toString('base64')`
113
+ - Improved media URL handling and base64 encoding for better chatbot integration
114
+ - Enhanced image message detection and processing workflow
115
+
116
+ * **Evolution Manager v2 Linting**: Resolved ESLint configuration conflicts
117
+ - Disabled conflicting Prettier rules in ESLint configuration
118
+ - Added comprehensive rule overrides for TypeScript and React patterns
119
+ - Fixed import ordering and code formatting issues
120
+ - Updated security vulnerabilities in dependencies (Vite, esbuild)
121
+
122
+ ### Code Quality & Refactoring
123
+
124
+ * **Chatbot Services**: Streamlined media message handling across all chatbot integrations
125
+ - Standardized base64 and mediaUrl processing patterns
126
+ - Improved code readability and maintainability in media handling logic
127
+ - Enhanced error handling for media download and conversion processes
128
+ - Unified image message detection across different chatbot services
129
+
130
+ * **Database Operations**: Improved data consistency and validation
131
+ - Enhanced Prisma schema compliance across all message operations
132
+ - Removed redundant instance name references for better data integrity
133
+ - Optimized message creation workflow with proper field validation
134
+
135
+ ### Environment Variables
136
+
137
+ * Added comprehensive Kafka configuration options:
138
+ - `KAFKA_ENABLED`, `KAFKA_CLIENT_ID`, `KAFKA_BROKERS`
139
+ - `KAFKA_CONSUMER_GROUP_ID`, `KAFKA_TOPIC_PREFIX`
140
+ - `KAFKA_SASL_*` and `KAFKA_SSL_*` for authentication
141
+ - `KAFKA_EVENTS_*` for event type configuration
142
+
143
+ # 2.3.3 (2025-09-18)
144
+
145
+ ### Features
146
+
147
+ * Add extra fields to object sent to Flowise bot
148
+ * Add Prometheus-compatible /metrics endpoint (gated by PROMETHEUS_METRICS)
149
+ * Implement linkPreview support for Evolution Bot
150
+
151
+ ### Fixed
152
+
153
+ * Address Path Traversal vulnerability in /assets endpoint by implementing security checks
154
+ * Configure Husky and lint-staged for automated code quality checks on commits and pushes
155
+ * Convert mediaKey from media messages to avoid bad decrypt errors
156
+ * Improve code formatting for better readability in WhatsApp service files
157
+ * Format messageGroupId assignment for improved readability
158
+ * Improve linkPreview implementation based on PR feedback
159
+ * Clean up code formatting for linkPreview implementation
160
+ * Use 'unknown' as fallback for clientName label
161
+ * Remove abort process when status is paused, allowing the chatbot return after the time expires and after being paused due to human interaction (stopBotFromMe)
162
+ * Enhance message content sanitization in Baileys service and improve message retrieval logic in Chatwoot service
163
+ * Integrate Typebot status change events for webhook in chatbot controller and service
164
+ * Mimetype of videos video
165
+
166
+ ### Security
167
+
168
+ * **CRITICAL**: Fixed Path Traversal vulnerability in /assets endpoint that allowed unauthenticated local file read
169
+ * Customizable Websockets Security
170
+
171
+ ### Testing
172
+
173
+ * Baileys Updates: v7.0.0-rc.3 ([Link](https://github.com/WhiskeySockets/Baileys/releases/tag/v7.0.0-rc.3))
174
+
175
+ # 2.3.2 (2025-09-02)
176
+
177
+ ### Features
178
+
179
+ * Add support to socks proxy
180
+
181
+ ### Fixed
182
+
183
+ * Added key id into webhook payload in n8n service
184
+ * Enhance RabbitMQ controller with improved connection management and shutdown procedures
185
+ * Convert outgoing images to JPEG before sending with Chatwoot
186
+ * Update baileys dependency to version 6.7.19
187
+
188
+ # 2.3.1 (2025-07-29)
189
+
190
+ ### Feature
191
+
192
+ * Add BaileysMessageProcessor for improved message handling and integrate rxjs for asynchronous processing
193
+ * Enhance message processing with retry logic for error handling
194
+
195
+ ### Fixed
196
+
197
+ * Update Baileys Version
198
+ * Update Dockerhub Repository and Delete Config Session Variable
199
+ * Fixed sending variables in typebot
200
+ * Add unreadMessages in the response
201
+ * Phone number as message ID for Evo AI
202
+ * Fix upload to s3 when media message
203
+ * Simplify edited message check in BaileysStartupService
204
+ * Avoid corrupting URLs with query strings
205
+ * Removed CONFIG_SESSION_PHONE_VERSION environment variable
206
+
207
+ # 2.3.0 (2025-06-17 09:19)
208
+
209
+ ### Feature
210
+
211
+ * Add support to get Catalogs and Collections with new routes: '{{baseUrl}}/chat/fetchCatalogs' and '{{baseUrl}}/chat/fetchCollections'
212
+ * Add NATS integration support to the event system
213
+ * Add message location support meta
214
+ * Add S3_SKIP_POLICY env variable to disable setBucketPolicy for incompatible providers
215
+ * Add EvoAI integration with models, services, and routes
216
+ * Add N8n integration with models, services, and routes
217
+
218
+ ### Fixed
219
+
220
+ * Shell injection vulnerability
221
+ * Update Baileys Version v6.7.18
222
+ * Audio send duplicate from chatwoot
223
+ * Chatwoot csat creating new conversation in another language
224
+ * Refactor SQS controller to correct bug in sqs events by instance
225
+ * Adjustin cloud api send audio and video
226
+ * Preserve animation in GIF and WebP stickers
227
+ * Preventing use conversation from other inbox for the same user
228
+ * Ensure full WhatsApp compatibility for audio conversion (libopus, 48kHz, mono)
229
+ * Enhance message fetching and processing logic
230
+ * Added lid on whatsapp numbers router
231
+ * Now if the CONFIG_SESSION_PHONE_VERSION variable is not filled in it automatically searches for the most updated version
232
+
233
+ ### Security
234
+
235
+ * Change execSync to execFileSync
236
+ * Enhance WebSocket authentication and connection handling
237
+
238
+ # 2.2.3 (2025-02-03 11:52)
239
+
240
+ ### Fixed
241
+
242
+ * Fix cache in local file system
243
+ * Update Baileys Version
244
+
245
+ # 2.2.2 (2025-01-31 06:55)
246
+
247
+ ### Features
248
+
249
+ * Added prefix key to queue name in RabbitMQ
250
+
251
+ ### Fixed
252
+
253
+ * Update Baileys Version
254
+
255
+ # 2.2.1 (2025-01-22 14:37)
256
+
257
+ ### Features
258
+
259
+ * Retry system for send webhooks
260
+ * Message filtering to support timestamp range queries
261
+ * Chats filtering to support timestamp range queries
262
+
263
+ ### Fixed
264
+
265
+ * Correction of webhook global
266
+ * Fixed send audio with whatsapp cloud api
267
+ * Refactor on fetch chats
268
+ * Refactor on Evolution Channel
269
+
270
+ # 2.2.0 (2024-10-18 10:00)
271
+
272
+ ### Features
273
+
274
+ * Fake Call function
275
+ * Send List with Baileys
276
+ * Send Buttons with Baileys
277
+ * Added unreadMessages to chats
278
+ * Pusher event integration
279
+ * Add support for splitMessages and timePerChar in Integrations
280
+ * Audio Converter via API
281
+ * Send PTV messages with Baileys
282
+
283
+ ### Fixed
284
+
285
+ * Fixed prefilledVariables in startTypebot
286
+ * Fix duplicate file upload
287
+ * Mark as read from me and groups
288
+ * Fetch chats query
289
+ * Ads messages in chatwoot
290
+ * Add indexes to improve performance in Evolution
291
+ * Add logical or permanent message deletion based on env config
292
+ * Add support for fetching multiple instances by key
293
+ * Update instance.controller.ts to filter by instanceName
294
+ * Receive template button reply message
295
+
296
+ # 2.1.2 (2024-10-06 10:09)
297
+
298
+ ### Features
299
+
300
+ * Sync lost messages on chatwoot
301
+ * Set the maximum number of listeners that can be registered for events
302
+ * Now is possible send medias with form-data
303
+
304
+ ### Fixed
305
+
306
+ * Fetch status message
307
+ * Adjusts in migrations
308
+ * Update pushName in chatwoot
309
+ * Validate message before sending chatwoot
310
+ * Adds the message status to the return of the "prepareMessage" function
311
+ * Fixed openai setting when send a message with chatwoot
312
+ * Fix buildkey function in hSet and hDelete
313
+ * Fix mexico number
314
+ * Update baileys version
315
+ * Update in Baileys version that fixes timeout when updating profile picture
316
+ * Adjusts for fix timeout error on send status message
317
+ * Chatwoot verbose logs
318
+ * Adjusts on prisma connections
319
+ * License terms updated
320
+ * Fixed send message to group without no cache (local or redis)
321
+ * Fixed startTypebot with startSession = true
322
+ * Fixed issue of always creating a new label when saving chatwoot
323
+ * Fixed getBase64FromMediaMessage with convertToMp4
324
+ * Fixed bug when send message when don't have mentionsEveryOne on payload
325
+ * Does not search message without chatwoot Message Id for reply
326
+ * Fixed bot fallback not working on integrations
327
+
328
+ # 2.1.1 (2024-09-22 10:31)
329
+
330
+ ### Features
331
+
332
+ * Define a global proxy to be used if the instance does not have one
333
+ * Save is on whatsapp on the database
334
+ * Add headers to the instance's webhook registration
335
+ * Debounce message break is now "\n" instead of white space
336
+ * Single view messages are now supported in chatwoot
337
+ * Chatbots can now send any type of media
338
+
339
+ ### Fixed
340
+
341
+ * Validate if cache exists before accessing it
342
+ * Missing autoCreate chatwoot in instance create
343
+ * Fixed bugs in the frontend, on the event screens
344
+ * Fixed use chatwoot with evolution channel
345
+ * Fix chatwoot reply quote with Cloud API
346
+ * Use exchange name from .env on RabbitMQ
347
+ * Fixed chatwoot screen
348
+ * It is now possible to send images via the Evolution Channel
349
+ * Removed "version" from docker-compose as it is obsolete (https://dev.to/ajeetraina/do-we-still-use-version-in-compose-3inp)
350
+ * Fixed typebot ignoreJids being used only from default settings
351
+ * Fixed Chatwoot inbox creation on save
352
+ * Changed axios timeout for manager requests for 30s
353
+ * Update in Baileys version that fixes timeout when updating profile picture
354
+ * Fixed issue when sending links in markdown by chatbots like Dify
355
+ * Fixed issue with chatbots not respecting settings
356
+
357
+ # 2.1.0 (2024-08-26 15:33)
358
+
359
+ ### Features
360
+
361
+ * Improved layout manager
362
+ * Translation in manager: English, Portuguese, Spanish and French
363
+ * Evolution Bot Integration
364
+ * Option to disable chatwoot bot contact with CHATWOOT_BOT_CONTACT
365
+ * Added flowise integration
366
+ * Added evolution channel on instance create
367
+ * Change in license to Apache-2.0
368
+ * Mark All in events
369
+
370
+ ### Fixed
371
+
372
+ * Refactor integrations structure for modular system
373
+ * Fixed dify agent integration
374
+ * Update Baileys Version
375
+ * Fixed proxy config in manager
376
+ * Fixed send messages in groups
377
+ * S3 saving media sent from me
378
+ * Fixed duplication bot when use startTypebot
379
+
380
+ ### Break Changes
381
+
382
+ * Payloads for events changed (create Instance and set events). Check postman to understand
383
+
384
+ # 2.0.10 (2024-08-16 16:23)
385
+
386
+ ### Features
387
+
388
+ * OpenAI send images when markdown
389
+ * Dify send images when markdown
390
+ * Sentry implemented
391
+
392
+ ### Fixed
393
+
394
+ * Fix on get profilePicture
395
+ * Added S3_REGION on minio settings
396
+
397
+ # 2.0.9 (2024-08-15 12:31)
398
+
399
+ ### Features
400
+
401
+ * Added ignoreJids in chatwoot settings
402
+ * Dify now identifies images
403
+ * Openai now identifies images
404
+
405
+ ### Fixed
406
+
407
+ * Path mapping & deps fix & bundler changed to tsup
408
+ * Improve database scripts to retrieve the provider from env file
409
+ * Update contacts database with unique index
410
+ * Save chat name
411
+ * Correction of media as attachments in chatwoot when using a Meta API Instance and not Baileys
412
+ * Update Baileys version 6.7.6
413
+ * Deprecate buttons and list in new Baileys version
414
+ * Changed labels to be unique on the same instance
415
+ * Remove instance from redis even if using database
416
+ * Unified integration session system so they don't overlap
417
+ * Temporary fix for pictureUrl bug in groups
418
+ * Fix on migrations
419
+
420
+ # 2.0.9-rc (2024-08-09 18:00)
421
+
422
+ ### Features
423
+
424
+ * Added general session button in typebot, dify and openai in manager
425
+ * Added compatibility with mysql through prisma
426
+
427
+ ### Fixed
428
+
429
+ * Import contacts with image in chatwoot
430
+ * Fix conversationId when is dify agent
431
+ * Fixed loading of selects in the manager
432
+ * Add restart button to sessions screen
433
+ * Adjustments to docker files
434
+ * StopBotFromMe working with chatwoot
435
+
436
+ # 2.0.8-rc (2024-08-08 20:23)
437
+
438
+ ### Features
439
+
440
+ * Variables passed to the input in dify
441
+ * OwnerJid passed to typebot
442
+ * Function for openai assistant added
443
+
444
+ ### Fixed
445
+
446
+ * Adjusts in telemetry
447
+
448
+ # 2.0.7-rc (2024-08-03 14:04)
449
+
450
+ ### Fixed
451
+
452
+ * BusinessId added on create instances in manager
453
+ * Adjusts in restart instance
454
+ * Resolve issue with connecting to instance
455
+ * Session is now individual per instance and remoteJid
456
+ * Credentials verify on manager login
457
+ * Added description column on typebot, dify and openai
458
+ * Fixed dify agent integration
459
+
460
+ # 2.0.6-rc (2024-08-02 19:23)
461
+
462
+ ### Features
463
+
464
+ * Get models for OpenAI
465
+
466
+ ### Fixed
467
+
468
+ * fetchInstances with clientName parameter
469
+ * fixed update typebot, openai and dify
470
+
471
+ # 2.0.5-rc (2024-08-01 18:01)
472
+
473
+ ### Features
474
+
475
+ * Speech to Text with Openai
476
+
477
+ ### Fixed
478
+
479
+ * ClientName on infos
480
+ * Instance screen scroll bar in manager
481
+
482
+ # 2.0.4-rc (2024-07-30 14:13)
483
+
484
+ ### Features
485
+
486
+ * New manager v2.0
487
+ * Dify integration
488
+
489
+ ### Fixed
490
+
491
+ * Update Baileys Version
492
+ * Adjusts for new manager
493
+ * Corrected openai trigger validation
494
+ * Corrected typebot trigger validation
495
+
496
+ # 2.0.3-beta (2024-07-29 09:03)
497
+
498
+ ### Features
499
+
500
+ * Webhook url by submitted template to send status updates
501
+ * Sending template approval status webhook
502
+
503
+ ### Fixed
504
+
505
+ * Equations and adjustments for the new manager
506
+ * Adjust TriggerType for OpenAI and Typebot integrations
507
+ * Fixed Typebot start call with active session
508
+
509
+ # 2.0.2-beta (2024-07-18 21:33)
510
+
511
+ ### Feature
512
+
513
+ * Open AI implemented
514
+
515
+ ### Fixed
516
+
517
+ * Fixed the function of saving or not saving data in the database
518
+ * Resolve not find name
519
+ * Removed DEL_TEMP_INSTANCES as it is not being used
520
+ * Fixed global exchange name
521
+ * Add apiKey and serverUrl to prefilledVariables in typebot service
522
+ * Correction in start typebot, if it doesn't exist, create it
523
+
524
+ # 2.0.1-beta (2024-07-17 17:01)
525
+
526
+ ### Fixed
527
+
528
+ * Resolved issue with Chatwoot not receiving messages sent by Typebot
529
+
530
+ # 2.0.0-beta (2024-07-14 17:00)
531
+
532
+ ### Feature
533
+
534
+ * Added prisma orm, connection to postgres and mysql
535
+ * Added chatwoot integration activation
536
+ * Added typebot integration activation
537
+ * Now you can register several typebots with triggers
538
+ * Media sent to typebot now goes as a template string, example: imageMessage|MESSAGE_ID
539
+ * Organization configuration and logo in chatwoot bot contact
540
+ * Added debounce time for typebot messages
541
+ * Tagging in chatwoot contact by instance
542
+ * Add support for managing WhatsApp templates via official API
543
+ * Fixes and implementation of regex and fallback in typebot
544
+ * Ignore jids configuration added to typebot (will be used for both groups and contacts)
545
+ * Minio and S3 integration
546
+ * When S3 integration enabled, the media sent to typebot now goes as a template string, example: imageMessage|MEDIA_URL
547
+
548
+ ### Fixed
549
+
550
+ * Removed excessive verbose logs
551
+ * Optimization in instance registration
552
+ * Now in typebot we wait until the terminal block to accept the user's message, if it arrives before the block is sent, it is ignored
553
+ * Correction of audio sending, now we can speed it up and have the audio wireframe
554
+ * Reply with media message on Chatwoot
555
+ * improvements in sending status and groups
556
+ * Correction in response returns from buttons, lists and templates
557
+ * EvolutionAPI/Baileys implemented
558
+
559
+ ### Break changes
560
+
561
+ * jwt authentication removed
562
+ * Connection to mongodb removed
563
+ * Standardized all request bodies to use camelCase
564
+ * Change in webhook information from owner to instanceId
565
+ * Changed the .env file configuration, removed the yml version and added .env to the repository root
566
+ * Removed the mobile type connection with Baileys
567
+ * Simplified payloads and endpoints
568
+ * Improved Typebot
569
+ - Now you can register several typebots
570
+ - Start configuration by trigger or for all
571
+ - Session search by typebot or remoteJid
572
+ - KeepOpen configuration (keeps the session even when the bot ends, to run once per contact)
573
+ - StopBotFromMe configuration, allows me to stop the bot if I send a chat message.
574
+ * Changed the way the goal webhook is configured
575
+
576
+ # 1.8.2 (2024-07-03 13:50)
577
+
578
+ ### Fixed
579
+
580
+ * Corretion in globall rabbitmq queue name
581
+ * Improvement in the use of mongodb database for credentials
582
+ * Fixed base64 in webhook for documentWithCaption
583
+ * Fixed Generate pairing code
584
+
585
+ # 1.8.1 (2024-06-08 21:32)
586
+
587
+ ### Feature
588
+
589
+ * New method of saving sessions to a file using worker, made in partnership with [codechat](https://github.com/code-chat-br/whatsapp-api)
590
+
591
+ ### Fixed
592
+
593
+ * Correction of variables breaking lines in typebot
594
+
595
+ ### Fixed
596
+
597
+ * Correction of variables breaking lines in typebot
598
+
599
+ # 1.8.0 (2024-05-27 16:10)
600
+
601
+ ### Feature
602
+
603
+ * Now in the manager, when logging in with the client's apikey, the listing only shows the instance corresponding to the provided apikey (only with MongoDB)
604
+ * New global mode for rabbitmq events
605
+ * Build in docker for linux/amd64, linux/arm64 platforms
606
+
607
+ ### Fixed
608
+
609
+ * Correction in message formatting when generated by AI as markdown in typebot
610
+ * Security fix in fetch instance with client key when not connected to mongodb
611
+
612
+ # 1.7.5 (2024-05-21 08:50)
613
+
614
+ ### Fixed
615
+
616
+ * Add merge_brazil_contacts function to solve nine digit in brazilian numbers
617
+ * Optimize ChatwootService method for updating contact
618
+ * Fix swagger auth
619
+ * Update aws sdk v3
620
+ * Fix getOpenConversationByContact and init queries error
621
+ * Method to mark chat as unread
622
+ * Added environment variable to manually select the WhatsApp web version for the baileys lib (optional)
623
+
624
+ # 1.7.4 (2024-04-28 09:46)
625
+
626
+ ### Fixed
627
+
628
+ * Adjusts in proxy on fetchAgent
629
+ * Recovering messages lost with redis cache
630
+ * Log when init redis cache service
631
+ * Recovering messages lost with redis cache
632
+ * Chatwoot inbox name
633
+ * Update Baileys version
634
+
635
+ # 1.7.3 (2024-04-18 12:07)
636
+
637
+ ### Fixed
638
+
639
+ * Revert fix audio encoding
640
+ * Recovering messages lost with redis cache
641
+ * Adjusts in redis for save instances
642
+ * Adjusts in proxy
643
+ * Revert pull request #523
644
+ * Added instance name on logs
645
+ * Added support for Spanish
646
+ * Fix error: invalid operator. The allowed operators for identifier are equal_to,not_equal_to in chatwoot
647
+
648
+ # 1.7.2 (2024-04-12 17:31)
649
+
650
+ ### Feature
651
+
652
+ * Mobile connection via sms (test)
653
+
654
+ ### Fixed
655
+
656
+ * Adjusts in redis
657
+ * Send global event in websocket
658
+ * Adjusts in proxy
659
+ * Fix audio encoding
660
+ * Fix conversation read on chatwoot version 3.7
661
+ * Fix when receiving/sending messages from whatsapp desktop with ephemeral messages enabled
662
+ * Changed returned sessions on typebot status change
663
+ * Reorganization of files and folders
664
+
665
+ # 1.7.1 (2024-04-03 10:19)
666
+
667
+ ### Fixed
668
+
669
+ * Correction when sending files with captions on Whatsapp Business
670
+ * Correction in receiving messages with response on WhatsApp Business
671
+ * Correction when sending a reaction to a message on WhatsApp Business
672
+ * Correction of receiving reactions on WhatsApp business
673
+ * Removed mandatory description of rows from sendList
674
+ * Feature to collect message type in typebot
675
+
676
+ # 1.7.0 (2024-03-11 18:23)
677
+
678
+ ### Feature
679
+
680
+ * Added update message endpoint
681
+ * Add translate capabilities to QRMessages in CW
682
+ * Join in Group by Invite Code
683
+ * Read messages from whatsapp in chatwoot
684
+ * Add support to use use redis in cacheservice
685
+ * Add support for labels
686
+ * Command to clearcache from chatwoot inbox
687
+ * Whatsapp Cloud API Oficial
688
+
689
+ ### Fixed
690
+
691
+ * Proxy configuration improvements
692
+ * Correction in sending lists
693
+ * Adjust in webhook_base64
694
+ * Correction in typebot text formatting
695
+ * Correction in chatwoot text formatting and render list message
696
+ * Only use a axios request to get file mimetype if necessary
697
+ * When possible use the original file extension
698
+ * When receiving a file from whatsapp, use the original filename in chatwoot if possible
699
+ * Remove message ids cache in chatwoot to use chatwoot's api itself
700
+ * Adjusts the quoted message, now has contextInfo in the message Raw
701
+ * Collecting responses with text or numbers in Typebot
702
+ * Added sendList endpoint to swagger documentation
703
+ * Implemented a function to synchronize message deletions on WhatsApp, automatically reflecting in Chatwoot.
704
+ * Improvement on numbers validation
705
+ * Fix polls in message sending
706
+ * Sending status message
707
+ * Message 'connection successfully' spamming
708
+ * Invalidate the conversation cache if reopen_conversation is false and the conversation was resolved
709
+ * Fix looping when deleting a message in chatwoot
710
+ * When receiving a file from whatsapp, use the original filename in chatwoot if possible
711
+ * Correction in the sendList Function
712
+ * Implement contact upsert in messaging-history.set
713
+ * Improve proxy error handling
714
+ * Refactor fetching participants for group in WhatsApp service
715
+ * Fixed problem where the typebot final keyword did not work
716
+ * Typebot's wait now pauses the flow and composing is defined by the delay_message parameter in set typebot
717
+ * Composing over 20s now loops until finished
718
+
719
+ # 1.6.1 (2023-12-22 11:43)
720
+
721
+ ### Fixed
722
+
723
+ * Fixed Lid Messages
724
+ * Fixed sending variables to typebot
725
+ * Fixed sending variables from typebot
726
+ * Correction sending s3/minio media to chatwoot and typebot
727
+ * Fixed the problem with typebot closing at the end of the flow, now this is optional with the TYPEBOT_KEEP_OPEN variable
728
+ * Fixed chatwoot Bold, Italic and Underline formatting using Regex
729
+ * Added the sign_delimiter property to the Chatwoot configuration, allowing you to set a different delimiter for the signature. Default when not defined \n
730
+ * Include instance Id field in the instance configuration
731
+ * Fixed the pairing code
732
+ * Adjusts in typebot
733
+ * Fix the problem when disconnecting the instance and connecting again using mongodb
734
+ * Options to disable docs and manager
735
+ * When deleting a message in whatsapp, delete the message in chatwoot too
736
+
737
+
738
+ # 1.6.0 (2023-12-12 17:24)
739
+
740
+ ### Feature
741
+
742
+ * Added AWS SQS Integration
743
+ * Added support for new typebot API
744
+ * Added endpoint sendPresence
745
+ * New Instance Manager
746
+ * Added auto_create to the chatwoot set to create the inbox automatically or not
747
+ * Added reply, delete and message reaction in chatwoot v3.3.1
748
+
749
+ ### Fixed
750
+
751
+ * Adjusts in proxy
752
+ * Adjusts in start session for Typebot
753
+ * Added mimetype field when sending media
754
+ * Ajusts in validations to messages.upsert
755
+ * Fixed messages not received: error handling when updating contact in chatwoot
756
+ * Fix workaround to manage param data as an array in mongodb
757
+ * Removed await from webhook when sending a message
758
+ * Update typebot.service.ts - element.underline change ~ for *
759
+ * Removed api restart on receiving an error
760
+ * Fixes in mongodb and chatwoot
761
+ * Adjusted return from queries in mongodb
762
+ * Added restart instance when update profile picture
763
+ * Correction of chatwoot functioning with admin flows
764
+ * Fixed problem that did not generate qrcode with the chatwoot_conversation_pending option enabled
765
+ * Fixed issue where CSAT opened a new ticket when reopen_conversation was disabled
766
+ * Fixed issue sending contact to Chatwoot via iOS
767
+
768
+ ### Integrations
769
+
770
+ * Chatwoot: v3.3.1
771
+ * Typebot: v2.20.0
772
+
773
+ # 1.5.4 (2023-10-09 20:43)
774
+
775
+ ### Fixed
776
+
777
+ * Baileys logger typing issue resolved
778
+ * Solved problem with duplicate messages in chatwoot
779
+
780
+ # 1.5.3 (2023-10-06 18:55)
781
+
782
+ ### Feature
783
+
784
+ * Swagger documentation
785
+ * Added base 64 sending option via webhook
786
+
787
+ ### Fixed
788
+
789
+ * Remove rabbitmq queues when delete instances
790
+ * Improvement in restart instance to completely redo the connection
791
+ * Update node version: v20
792
+ * Correction of messages sent by the api and typebot not appearing in chatwoot
793
+ * Adjustment to start typebot, added startSession parameter
794
+ * Chatwoot now receives messages sent via api and typebot
795
+ * Fixed problem with starting with an input in typebot
796
+ * Added check to ensure variables are not empty before executing foreach in start typebot
797
+
798
+ # 1.5.2 (2023-09-28 17:56)
799
+
800
+ ### Fixed
801
+
802
+ * Fix chatwootSchema in chatwoot model to store reopen_conversation and conversation_pending options
803
+ * Problem resolved when sending files from minio to typebot
804
+ * Improvement in the "startTypebot" method to create persistent session when triggered
805
+ * New manager for Evo 1.5.2 - Set Typebot update
806
+ * Resolved problems when reading/querying instances
807
+
808
+ # 1.5.1 (2023-09-17 13:50)
809
+
810
+ ### Feature
811
+
812
+ * Added listening_from_me option in Set Typebot
813
+ * Added variables options in Start Typebot
814
+ * Added webhooks for typebot events
815
+ * Added ChamaAI integration
816
+ * Added webhook to send errors
817
+ * Added support for messaging with ads on chatwoot
818
+
819
+ ### Fixed
820
+
821
+ * Fix looping connection messages in chatwoot
822
+ * Improved performance of fetch instances
823
+
824
+ # 1.5.0 (2023-08-18 12:47)
825
+
826
+ ### Feature
827
+
828
+ * New instance manager in /manager route
829
+ * Added extra files for chatwoot and appsmith
830
+ * Added Get Last Message and Archive for Chat
831
+ * Added env var QRCODE_COLOR
832
+ * Added websocket to send events
833
+ * Added rabbitmq to send events
834
+ * Added Typebot integration
835
+ * Added proxy endpoint
836
+ * Added send and date_time in webhook data
837
+
838
+ ### Fixed
839
+
840
+ * Solved problem when disconnecting from the instance the instance was deleted
841
+ * Encoded spaces in chatwoot webhook
842
+ * Adjustment in the saving of contacts, saving the information of the number and Jid
843
+ * Update Dockerfile
844
+ * If you pass empty events in create instance and set webhook it is understood as all
845
+ * Fixed issue that did not output base64 averages
846
+ * Messages sent by the api now arrive in chatwoot
847
+
848
+ ### Integrations
849
+
850
+ * Chatwoot: v2.18.0 - v3.0.0
851
+ * Typebot: v2.16.0
852
+ * Manager Evolution API
853
+
854
+ # 1.4.8 (2023-07-27 10:27)
855
+
856
+ ### Fixed
857
+
858
+ * Fixed error return bug
859
+
860
+ # 1.4.7 (2023-07-27 08:47)
861
+
862
+ ### Fixed
863
+
864
+ * Fixed error return bug
865
+ * Fixed problem of getting message when deleting message in chatwoot
866
+ * Change in error return pattern
867
+
868
+ # 1.4.6 (2023-07-26 17:54)
869
+
870
+ ### Fixed
871
+
872
+ * Fixed bug of creating new inbox by chatwoot
873
+ * When conversation reopens is pending when conversation pending is true
874
+ * Added docker-compose file with dockerhub image
875
+
876
+ # 1.4.5 (2023-07-26 09:32)
877
+
878
+ ### Fixed
879
+
880
+ * Fixed problems in localization template in chatwoot
881
+ * Fix mids going duplicated in chatwoot
882
+
883
+ # 1.4.4 (2023-07-25 15:24)
884
+
885
+ ### Fixed
886
+
887
+ * Fixed chatwoot line wrap issue
888
+ * Solved receive location in chatwoot
889
+ * When requesting the pairing code, it also brings the qr code
890
+ * Option reopen_conversation in chatwoot endpoint
891
+ * Option conversation_pending in chatwoot endpoint
892
+
893
+ # 1.4.3 (2023-07-25 10:51)
894
+
895
+ ### Fixed
896
+
897
+ * Adjusts in settings with options always_online, read_messages and read_status
898
+ * Fixed send webhook for event CALL
899
+ * Create instance with settings
900
+
901
+ # 1.4.2 (2023-07-24 20:52)
902
+
903
+ ### Fixed
904
+
905
+ * Fixed validation is set settings
906
+ * Adjusts in group validations
907
+ * Ajusts in sticker message to chatwoot
908
+
909
+ # 1.4.1 (2023-07-24 18:28)
910
+
911
+ ### Fixed
912
+
913
+ * Fixed reconnect with pairing code or qrcode
914
+ * Fixed problem in createJid
915
+
916
+ # 1.4.0 (2023-07-24 17:03)
917
+
918
+ ### Features
919
+
920
+ * Added connection functionality via pairing code
921
+ * Added fetch profile endpoint in chat controller
922
+ * Created settings controller
923
+ * Added reject call and send text message when receiving a call
924
+ * Added setting to ignore group messages
925
+ * Added connection with pairing code in chatwoot with command /init:{NUMBER}
926
+ * Added encoding option in endpoint sendWhatsAppAudio
927
+
928
+ ### Fixed
929
+
930
+ * Added link preview option in send text message
931
+ * Fixed problem with fileSha256 appearing when sending a sticker in chatwoot
932
+ * Fixed issue where it was not possible to open a conversation when sent at first by me on my cell phone in chatwoot
933
+ * Now it only updates the contact name if it is the same as the phone number in chatwoot
934
+ * Now accepts all chatwoot inbox templates
935
+ * Command to create new instances set to /new_instance:{NAME}:{NUMBER}
936
+ * Fix in chatwoot set, sign msg can now be disabled
937
+
938
+ ### Integrations
939
+
940
+ * Chatwoot: v2.18.0 - v3.0.0 (Beta)
941
+
942
+ # 1.3.2 (2023-07-21 17:19)
943
+
944
+ ### Fixed
945
+
946
+ * Fix in update settings that needed to restart after updated
947
+ * Correction in the use of the api with mongodb
948
+ * Adjustments to search endpoint for contacts, chats, messages and Status messages
949
+ * Now when deleting the instance, the data referring to it in mongodb is also deleted
950
+ * It is now validated if the instance name contains uppercase and special characters
951
+ * For compatibility reasons, container mode has been removed
952
+ * Added docker-compose files example
953
+
954
+ ### Integrations
955
+
956
+ * Chatwoot: v2.18.0
957
+
958
+ # 1.3.1 (2023-07-20 07:48)
959
+
960
+ ### Fixed
961
+
962
+ * Adjust in create store files
963
+
964
+ ### Integrations
965
+
966
+ * Chatwoot: v2.18.0
967
+
968
+ # 1.3.0 (2023-07-19 11:33)
969
+
970
+ ### Features
971
+
972
+ * Added messages.delete event
973
+ * Added restart instance endpoint
974
+ * Created automation for creating instances in the chatwoot bot with the command '#inbox_whatsapp:{INSTANCE_NAME}
975
+ * Change Baileys version to: 6.4.0
976
+ * Send contact in chatwoot
977
+ * Send contact array in chatwoot
978
+ * Added apiKey in webhook and serverUrl in fetchInstance if EXPOSE_IN_FETCH_INSTANCES: true
979
+ * Translation set to default (english) in chatwoot
980
+
981
+ ### Fixed
982
+
983
+ * Fixed error to send message in large groups
984
+ * Docker files adjusted
985
+ * Fixed in the postman collection the webhookByEvent parameter by webhook_by_events
986
+ * Added validations in create instance
987
+ * Removed link preview endpoint, now it's done automatically from sending conventional text
988
+ * Added group membership validation before sending message to groups
989
+ * Adjusts in docker files
990
+ * Adjusts in returns in endpoints chatwoot and webhook
991
+ * Fixed ghost mentions in send text message
992
+ * Fixed bug that saved contacts from groups came without number in chatwoot
993
+ * Fixed problem to receive csat in chatwoot
994
+ * Fixed require fileName for document only in base64 for send media message
995
+ * Bug fix when sending mobile message change contact name to number in chatwoot
996
+ * Bug fix when connecting whatsapp does not send confirmation message
997
+ * Fixed quoted message with id or message directly
998
+ * Adjust in validation for mexican and argentine numbers
999
+ * Adjust in create store files
1000
+
1001
+ ### Integrations
1002
+
1003
+ * Chatwoot: v2.18.0
1004
+
1005
+ # 1.2.2 (2023-07-15 09:36)
1006
+
1007
+ ### Fixed
1008
+
1009
+ * Tweak in route "/" with version info
1010
+ * Adjusts chatwoot version
1011
+
1012
+ ### Integrations
1013
+
1014
+ * Chatwoot: v2.18.0
1015
+
1016
+ # 1.2.1 (2023-07-14 19:04)
1017
+
1018
+ ### Fixed
1019
+
1020
+ * Adjusts in docker files
1021
+ * Save picture url groups in chatwoot
1022
+
1023
+ # 1.2.0 (2023-07-14 15:28)
1024
+
1025
+ ### Features
1026
+
1027
+ * Native integration with chatwoot
1028
+ * Added returning or non-returning participants option in fetchAllGroups
1029
+ * Added group integration to chatwoot
1030
+ * Added automation on create instance to chatwoot
1031
+ * Added verbose logs and format chatwoot service
1032
+
1033
+ ### Fixed
1034
+
1035
+ * Adjusts in docker-compose files
1036
+ * Adjusts in number validation for AR and MX numbers
1037
+ * Adjusts in env files, removed save old_messages
1038
+ * Fix when sending a message to a group I don't belong returns a bad request
1039
+ * Fits the format on return from the fetchAllGroups endpoint
1040
+ * Adjust in send document with caption from chatwoot
1041
+ * Fixed message with undefind in chatwoot
1042
+ * Changed message in path /
1043
+ * Test duplicate message media in groups chatwoot
1044
+ * Optimize send message from group with mentions
1045
+ * Fixed name of the profile status in fetchInstances
1046
+ * Fixed error 500 when logout in instance with status = close
1047
+
1048
+ # 1.1.5 (2023-07-12 07:17)
1049
+
1050
+ ### Fixed
1051
+
1052
+ * Adjusts in temp folder
1053
+ * Return with event send_message
1054
+
1055
+ # 1.1.4 (2023-07-08 11:01)
1056
+
1057
+ ### Features
1058
+
1059
+ * Route to send status broadcast
1060
+ * Added verbose logs
1061
+ * Insert allContacts in payload of endpoint sendStatus
1062
+
1063
+ ### Fixed
1064
+
1065
+ * Adjusted set in webhook to go empty when enabled false
1066
+ * Adjust in store files
1067
+ * Fixed the problem when do not save contacts when receive messages
1068
+ * Changed owner of the jid for instanceName
1069
+ * Create .env for installation in docker
1070
+
1071
+ # 1.1.3 (2023-07-06 11:43)
1072
+
1073
+ ### Features
1074
+
1075
+ * Added configuration for Baileys log level in env
1076
+ * Added audio to mp4 converter in optionally get Base64 From MediaMessage
1077
+ * Added organization name in vcard
1078
+ * Added email in vcard
1079
+ * Added url in vcard
1080
+ * Added verbose logs
1081
+
1082
+ ### Fixed
1083
+
1084
+ * Added timestamp internally in urls to avoid caching
1085
+ * Correction in decryption of poll votes
1086
+ * Change in the way the api sent and saved the sent messages, now it goes in the messages.upsert event
1087
+ * Fixed cash when sending stickers via url
1088
+ * Improved how Redis works for instances
1089
+ * Fixed problem when disconnecting the instance it removes the instance
1090
+ * Fixed problem sending ack when preview is done by me
1091
+ * Adjust in store files
1092
+
1093
+ # 1.1.2 (2023-06-28 13:43)
1094
+
1095
+ ### Fixed
1096
+
1097
+ * Fixed baileys version in package.json
1098
+ * Fixed problem that did not validate if the token passed in create instance already existed
1099
+ * Fixed problem that does not delete instance files in server mode
1100
+
1101
+ # 1.1.1 (2023-06-28 10:27)
1102
+
1103
+ ### Features
1104
+
1105
+ * Added group invitation sending
1106
+ * Added webhook configuration per event in the individual instance registration
1107
+
1108
+ ### Fixed
1109
+
1110
+ * Adjust dockerfile variables
1111
+
1112
+ # 1.1.0 (2023-06-21 11:17)
1113
+
1114
+ ### Features
1115
+
1116
+ * Improved fetch instances endpoint, now it also fetch other instances even if they are not connected
1117
+ * Added conversion of audios for sending recorded audio, now it is possible to send mp3 audios and not just ogg
1118
+ * Route to fetch all groups that the connection is part of
1119
+ * Route to fetch all privacy settings
1120
+ * Route to update the privacy settings
1121
+ * Route to update group subject
1122
+ * Route to update group description
1123
+ * Route to accept invite code
1124
+ * Added configuration of events by webhook of instances
1125
+ * Now the api key can be exposed in fetch instances if the EXPOSE_IN_FETCH_INSTANCES variable is set to true
1126
+ * Added option to generate qrcode as soon as the instance is created
1127
+ * The created instance token can now also be optionally defined manually in the creation endpoint
1128
+ * Route to send Sticker
1129
+
1130
+ ### Fixed
1131
+
1132
+ * Adjust dockerfile variables
1133
+ * tweaks in docker-compose to pass variables
1134
+ * Adjust the route getProfileBusiness to fetchProfileBusiness
1135
+ * fix error after logout and try to get status or to connect again
1136
+ * fix sending narrated audio on whatsapp android and ios
1137
+ * fixed the problem of not disabling the global webhook by the variable
1138
+ * Adjustment in the recording of temporary files and periodic cleaning
1139
+ * Fix for container mode also work only with files
1140
+ * Remove recording of old messages on sync
1141
+
1142
+ # 1.0.9 (2023-06-10)
1143
+
1144
+ ### Fixed
1145
+
1146
+ * Adjust dockerfile variables
1147
+
1148
+ # 1.0.8 (2023-06-09)
1149
+
1150
+ ### Features
1151
+
1152
+ * Added Docker compose file
1153
+ * Added ChangeLog file
1154
+
1155
+ # 1.0.7 (2023-06-08)
1156
+
1157
+ ### Features
1158
+
1159
+ * Ghost mention
1160
+ * Mention in reply
1161
+ * Profile photo change
1162
+ * Profile name change
1163
+ * Profile status change
1164
+ * Sending a poll
1165
+ * Creation of LinkPreview if message contains URL
1166
+ * New webhooks system, which can be separated into a url per event
1167
+ * Sending the local webhook url as destination in the webhook data for webhook redirection
1168
+ * Startup modes, server or container
1169
+ * Server Mode works normally as everyone is used to
1170
+ * Container mode made to use one instance per container, when starting the application an instance is already created and the qrcode is generated and it starts sending webhook without having to call it manually, it only allows one instance at a time.
CLAUDE.md ADDED
@@ -0,0 +1,223 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CLAUDE.md
2
+
3
+ This file provides comprehensive guidance to Claude AI when working with the Evolution API codebase.
4
+
5
+ ## Project Overview
6
+
7
+ **Evolution API** is a powerful, production-ready REST API for WhatsApp communication that supports multiple WhatsApp providers:
8
+ - **Baileys** (WhatsApp Web) - Open-source WhatsApp Web client
9
+ - **Meta Business API** - Official WhatsApp Business API
10
+ - **Evolution API** - Custom WhatsApp integration
11
+
12
+ Built with **Node.js 20+**, **TypeScript 5+**, and **Express.js**, it provides extensive integrations with chatbots, CRM systems, and messaging platforms in a **multi-tenant architecture**.
13
+
14
+ ## Common Development Commands
15
+
16
+ ### Build and Run
17
+ ```bash
18
+ # Development
19
+ npm run dev:server # Run in development with hot reload (tsx watch)
20
+
21
+ # Production
22
+ npm run build # TypeScript check + tsup build
23
+ npm run start:prod # Run production build
24
+
25
+ # Direct execution
26
+ npm start # Run with tsx
27
+ ```
28
+
29
+ ### Code Quality
30
+ ```bash
31
+ npm run lint # ESLint with auto-fix
32
+ npm run lint:check # ESLint check only
33
+ npm run commit # Interactive commit with commitizen
34
+ ```
35
+
36
+ ### Database Management
37
+ ```bash
38
+ # Set database provider first
39
+ export DATABASE_PROVIDER=postgresql # or mysql
40
+
41
+ # Generate Prisma client (automatically uses DATABASE_PROVIDER env)
42
+ npm run db:generate
43
+
44
+ # Deploy migrations (production)
45
+ npm run db:deploy # Unix/Mac
46
+ npm run db:deploy:win # Windows
47
+
48
+ # Development migrations (with sync to provider folder)
49
+ npm run db:migrate:dev # Unix/Mac
50
+ npm run db:migrate:dev:win # Windows
51
+
52
+ # Open Prisma Studio
53
+ npm run db:studio
54
+
55
+ # Development migrations
56
+ npm run db:migrate:dev # Unix/Mac
57
+ npm run db:migrate:dev:win # Windows
58
+ ```
59
+
60
+ ### Testing
61
+ ```bash
62
+ npm test # Run tests with watch mode
63
+ ```
64
+
65
+ ## Architecture Overview
66
+
67
+ ### Core Structure
68
+ - **Multi-tenant SaaS**: Complete instance isolation with per-tenant authentication
69
+ - **Multi-provider database**: PostgreSQL and MySQL via Prisma ORM with provider-specific schemas and migrations
70
+ - **WhatsApp integrations**: Baileys, Meta Business API, and Evolution API with unified interface
71
+ - **Event-driven architecture**: EventEmitter2 for internal events + WebSocket, RabbitMQ, SQS, NATS, Pusher for external events
72
+ - **Microservices pattern**: Modular integrations for chatbots, storage, and external services
73
+
74
+ ### Directory Layout
75
+ ```
76
+ src/
77
+ ├── api/
78
+ │ ├── controllers/ # HTTP route handlers (thin layer)
79
+ │ ├── services/ # Business logic (core functionality)
80
+ │ ├── repository/ # Data access layer (Prisma)
81
+ │ ├── dto/ # Data Transfer Objects (simple classes)
82
+ │ ├── guards/ # Authentication/authorization middleware
83
+ │ ├── integrations/ # External service integrations
84
+ │ │ ├── channel/ # WhatsApp providers (Baileys, Business API, Evolution)
85
+ │ │ ├── chatbot/ # AI/Bot integrations (OpenAI, Dify, Typebot, Chatwoot)
86
+ │ │ ├── event/ # Event systems (WebSocket, RabbitMQ, SQS, NATS, Pusher)
87
+ │ │ └── storage/ # File storage (S3, MinIO)
88
+ │ ├── routes/ # Express route definitions (RouterBroker pattern)
89
+ │ └── types/ # TypeScript type definitions
90
+ ├── config/ # Environment and app configuration
91
+ ├── cache/ # Redis and local cache implementations
92
+ ├── exceptions/ # Custom HTTP exception classes
93
+ ├── utils/ # Shared utilities and helpers
94
+ └── validate/ # JSONSchema7 validation schemas
95
+ ```
96
+
97
+ ### Key Integration Points
98
+
99
+ **Channel Integrations** (`src/api/integrations/channel/`):
100
+ - **Baileys**: WhatsApp Web client with QR code authentication
101
+ - **Business API**: Official Meta WhatsApp Business API
102
+ - **Evolution API**: Custom WhatsApp integration
103
+ - Connection lifecycle management per instance with automatic reconnection
104
+
105
+ **Chatbot Integrations** (`src/api/integrations/chatbot/`):
106
+ - **EvolutionBot**: Native chatbot with trigger system
107
+ - **Chatwoot**: Customer service platform integration
108
+ - **Typebot**: Visual chatbot flow builder
109
+ - **OpenAI**: AI capabilities including GPT and Whisper (audio transcription)
110
+ - **Dify**: AI agent workflow platform
111
+ - **Flowise**: LangChain visual builder
112
+ - **N8N**: Workflow automation platform
113
+ - **EvoAI**: Custom AI integration
114
+
115
+ **Event Integrations** (`src/api/integrations/event/`):
116
+ - **WebSocket**: Real-time Socket.io connections
117
+ - **RabbitMQ**: Message queue for async processing
118
+ - **Amazon SQS**: Cloud-based message queuing
119
+ - **NATS**: High-performance messaging system
120
+ - **Pusher**: Real-time push notifications
121
+
122
+ **Storage Integrations** (`src/api/integrations/storage/`):
123
+ - **AWS S3**: Cloud object storage
124
+ - **MinIO**: Self-hosted S3-compatible storage
125
+ - Media file management and URL generation
126
+
127
+ ### Database Schema Management
128
+ - Separate schema files: `postgresql-schema.prisma` and `mysql-schema.prisma`
129
+ - Environment variable `DATABASE_PROVIDER` determines active database
130
+ - Migration folders are provider-specific and auto-selected during deployment
131
+
132
+ ### Authentication & Security
133
+ - **API key-based authentication** via `apikey` header (global or per-instance)
134
+ - **Instance-specific tokens** for WhatsApp connection authentication
135
+ - **Guards system** for route protection and authorization
136
+ - **Input validation** using JSONSchema7 with RouterBroker `dataValidate`
137
+ - **Rate limiting** and security middleware
138
+ - **Webhook signature validation** for external integrations
139
+
140
+ ## Important Implementation Details
141
+
142
+ ### WhatsApp Instance Management
143
+ - Each WhatsApp connection is an "instance" with unique name
144
+ - Instance data stored in database with connection state
145
+ - Session persistence in database or file system (configurable)
146
+ - Automatic reconnection handling with exponential backoff
147
+
148
+ ### Message Queue Architecture
149
+ - Supports RabbitMQ, Amazon SQS, and WebSocket for events
150
+ - Event types: message.received, message.sent, connection.update, etc.
151
+ - Configurable per instance which events to send
152
+
153
+ ### Media Handling
154
+ - Local storage or S3/Minio for media files
155
+ - Automatic media download from WhatsApp
156
+ - Media URL generation for external access
157
+ - Support for audio transcription via OpenAI
158
+
159
+ ### Multi-tenancy Support
160
+ - Instance isolation at database level
161
+ - Separate webhook configurations per instance
162
+ - Independent integration settings per instance
163
+
164
+ ## Environment Configuration
165
+
166
+ Key environment variables are defined in `.env.example`. The system uses a strongly-typed configuration system via `src/config/env.config.ts`.
167
+
168
+ Critical configurations:
169
+ - `DATABASE_PROVIDER`: postgresql or mysql
170
+ - `DATABASE_CONNECTION_URI`: Database connection string
171
+ - `AUTHENTICATION_API_KEY`: Global API authentication
172
+ - `REDIS_ENABLED`: Enable Redis cache
173
+ - `RABBITMQ_ENABLED`/`SQS_ENABLED`: Message queue options
174
+
175
+ ## Development Guidelines
176
+
177
+ The project follows comprehensive development standards defined in `.cursor/rules/`:
178
+
179
+ ### Core Principles
180
+ - **Always respond in Portuguese (PT-BR)** for user communication
181
+ - **Follow established architecture patterns** (Service Layer, RouterBroker, etc.)
182
+ - **Robust error handling** with retry logic and graceful degradation
183
+ - **Multi-database compatibility** (PostgreSQL and MySQL)
184
+ - **Security-first approach** with input validation and rate limiting
185
+ - **Performance optimizations** with Redis caching and connection pooling
186
+
187
+ ### Code Standards
188
+ - **TypeScript strict mode** with full type coverage
189
+ - **JSONSchema7** for input validation (not class-validator)
190
+ - **Conventional Commits** enforced by commitlint
191
+ - **ESLint + Prettier** for code formatting
192
+ - **Service Object pattern** for business logic
193
+ - **RouterBroker pattern** for route handling with `dataValidate`
194
+
195
+ ### Architecture Patterns
196
+ - **Multi-tenant isolation** at database and instance level
197
+ - **Event-driven communication** with EventEmitter2
198
+ - **Microservices integration** pattern for external services
199
+ - **Connection pooling** and lifecycle management
200
+ - **Caching strategy** with Redis primary and Node-cache fallback
201
+
202
+ ## Testing Approach
203
+
204
+ Currently, the project has minimal formal testing infrastructure:
205
+ - **Manual testing** is the primary approach
206
+ - **Integration testing** in development environment
207
+ - **No unit test suite** currently implemented
208
+ - Test files can be placed in `test/` directory as `*.test.ts`
209
+ - Run `npm test` for watch mode development testing
210
+
211
+ ### Recommended Testing Strategy
212
+ - Focus on **critical business logic** in services
213
+ - **Mock external dependencies** (WhatsApp APIs, databases)
214
+ - **Integration tests** for API endpoints
215
+ - **Manual testing** for WhatsApp connection flows
216
+
217
+ ## Deployment Considerations
218
+
219
+ - Docker support with `Dockerfile` and `docker-compose.yaml`
220
+ - Graceful shutdown handling for connections
221
+ - Health check endpoints for monitoring
222
+ - Sentry integration for error tracking
223
+ - Telemetry for usage analytics (non-sensitive data only)
Dockerfile.metrics ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM evoapicloud/evolution-api:latest AS base
2
+ WORKDIR /evolution
3
+
4
+ # Copiamos apenas o necessário para recompilar o dist com as mudanças locais
5
+ COPY tsconfig.json tsup.config.ts package.json ./
6
+ COPY src ./src
7
+
8
+ # Recompila usando os node_modules já presentes na imagem base
9
+ RUN npm run build
10
+
11
+ # Runtime final: reaproveita a imagem oficial e apenas sobrepõe o dist
12
+ FROM evoapicloud/evolution-api:latest AS final
13
+ WORKDIR /evolution
14
+ COPY --from=base /evolution/dist ./dist
15
+
16
+ ENV PROMETHEUS_METRICS=true
17
+
18
+ # Entrada original da imagem oficial já sobe o app em /evolution
19
+
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Evolution API License
2
+
3
+ Evolution API is licensed under the Apache License 2.0, with the following additional conditions:
4
+
5
+ 1. Evolution API may be utilized commercially, including as a backend service for other applications or as an application development platform for enterprises. Should the conditions below be met, a commercial license must be obtained from the producer:
6
+
7
+ a. LOGO and copyright information: In the process of using Evolution API's frontend components, you may not remove or modify the LOGO or copyright information in the Evolution API console or applications. This restriction is inapplicable to uses of Evolution API that do not involve its frontend components.
8
+
9
+ b. Usage Notification Requirement: If Evolution API is used as part of any project, including closed-source systems (e.g., proprietary software), the user is required to display a clear notification within the system that Evolution API is being utilized. This notification should be visible to system administrators and accessible from the system's documentation or settings page. Failure to comply with this requirement may result in the necessity for a commercial license, as determined by the producer.
10
+
11
+ Please contact contato@evolution-api.com to inquire about licensing matters.
12
+
13
+ 2. As a contributor, you should agree that:
14
+
15
+ a. The producer can adjust the open-source agreement to be more strict or relaxed as deemed necessary.
16
+ b. Your contributed code may be used for commercial purposes, including but not limited to its cloud business operations.
17
+
18
+ Apart from the specific conditions mentioned above, all other rights and restrictions follow the Apache License 2.0. Detailed information about the Apache License 2.0 can be found at http://www.apache.org/licenses/LICENSE-2.0.
19
+
20
+ © 2025 Evolution API
21
+
SECURITY.md ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ We actively support the following versions of Evolution API with security updates:
6
+
7
+ | Version | Supported |
8
+ | ------- | ------------------ |
9
+ | 2.3.x | ✅ Yes |
10
+ | 2.2.x | ✅ Yes |
11
+ | 2.1.x | ⚠️ Critical fixes only |
12
+ | < 2.1 | ❌ No |
13
+
14
+ ## Reporting a Vulnerability
15
+
16
+ We take security vulnerabilities seriously. If you discover a security vulnerability in Evolution API, please help us by reporting it responsibly.
17
+
18
+ ### 🔒 Private Disclosure Process
19
+
20
+ **Please DO NOT create a public GitHub issue for security vulnerabilities.**
21
+
22
+ Instead, please report security vulnerabilities via email to:
23
+
24
+ **📧 contato@evolution-api.com**
25
+
26
+ ### 📋 What to Include
27
+
28
+ When reporting a vulnerability, please include:
29
+
30
+ - **Description**: A clear description of the vulnerability
31
+ - **Impact**: What an attacker could achieve by exploiting this vulnerability
32
+ - **Steps to Reproduce**: Detailed steps to reproduce the issue
33
+ - **Proof of Concept**: If possible, include a minimal proof of concept
34
+ - **Environment**: Version of Evolution API, OS, Node.js version, etc.
35
+ - **Suggested Fix**: If you have ideas for how to fix the issue
36
+
37
+ ### 🕐 Response Timeline
38
+
39
+ We will acknowledge receipt of your vulnerability report within **48 hours** and will send you regular updates about our progress.
40
+
41
+ - **Initial Response**: Within 48 hours
42
+ - **Status Update**: Within 7 days
43
+ - **Resolution Timeline**: Varies based on complexity, typically 30-90 days
44
+
45
+ ### 🎯 Scope
46
+
47
+ This security policy applies to:
48
+
49
+ - Evolution API core application
50
+ - Official Docker images
51
+ - Documentation that could lead to security issues
52
+
53
+ ### 🚫 Out of Scope
54
+
55
+ The following are generally considered out of scope:
56
+
57
+ - Third-party integrations (Chatwoot, Typebot, etc.) - please report to respective projects
58
+ - Issues in dependencies - please report to the dependency maintainers
59
+ - Social engineering attacks
60
+ - Physical attacks
61
+ - Denial of Service attacks
62
+
63
+ ### 🏆 Recognition
64
+
65
+ We believe in recognizing security researchers who help us keep Evolution API secure:
66
+
67
+ - We will acknowledge your contribution in our security advisories (unless you prefer to remain anonymous)
68
+ - For significant vulnerabilities, we may feature you in our Hall of Fame
69
+ - We will work with you on coordinated disclosure timing
70
+
71
+ ### 📚 Security Best Practices
72
+
73
+ For users deploying Evolution API:
74
+
75
+ - Always use the latest supported version
76
+ - Keep your dependencies up to date
77
+ - Use strong authentication methods
78
+ - Implement proper network security
79
+ - Monitor your logs for suspicious activity
80
+ - Follow the principle of least privilege
81
+
82
+ ### 🔄 Security Updates
83
+
84
+ Security updates will be:
85
+
86
+ - Released as patch versions (e.g., 2.3.1 → 2.3.2)
87
+ - Documented in our [CHANGELOG.md](./CHANGELOG.md)
88
+ - Announced in our community channels
89
+ - Tagged with security labels in GitHub releases
90
+
91
+ ## Contact
92
+
93
+ For any questions about this security policy, please contact:
94
+
95
+ - **Email**: contato@evolution-api.com
96
+
97
+ ---
98
+
99
+ Thank you for helping keep Evolution API and our community safe! 🛡️
commitlint.config.js ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ module.exports = {
2
+ extends: ['@commitlint/config-conventional'],
3
+ rules: {
4
+ 'type-enum': [
5
+ 2,
6
+ 'always',
7
+ [
8
+ 'feat', // New feature
9
+ 'fix', // Bug fix
10
+ 'docs', // Documentation changes
11
+ 'style', // Code style changes (formatting, etc)
12
+ 'refactor', // Code refactoring
13
+ 'perf', // Performance improvements
14
+ 'test', // Adding or updating tests
15
+ 'chore', // Maintenance tasks
16
+ 'ci', // CI/CD changes
17
+ 'build', // Build system changes
18
+ 'revert', // Reverting changes
19
+ 'security', // Security fixes
20
+ ],
21
+ ],
22
+ 'type-case': [2, 'always', 'lower-case'],
23
+ 'type-empty': [2, 'never'],
24
+ 'scope-case': [2, 'always', 'lower-case'],
25
+ 'subject-case': [2, 'never', ['sentence-case', 'start-case', 'pascal-case', 'upper-case']],
26
+ 'subject-empty': [2, 'never'],
27
+ 'subject-full-stop': [2, 'never', '.'],
28
+ 'header-max-length': [2, 'always', 100],
29
+ 'body-leading-blank': [1, 'always'],
30
+ 'body-max-line-length': [0, 'always', 150],
31
+ 'footer-leading-blank': [1, 'always'],
32
+ 'footer-max-line-length': [0, 'always', 150],
33
+ },
34
+ };
docker-compose.dev.yaml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ api:
3
+ container_name: evolution_api
4
+ image: evolution/api:local
5
+ build: .
6
+ restart: always
7
+ ports:
8
+ - 8080:8080
9
+ volumes:
10
+ - evolution_instances:/evolution/instances
11
+ networks:
12
+ - evolution-net
13
+ env_file:
14
+ - .env
15
+ expose:
16
+ - 8080
17
+
18
+ frontend:
19
+ container_name: evolution_frontend
20
+ image: evolution/manager:local
21
+ build: ./evolution-manager-v2
22
+ restart: always
23
+ ports:
24
+ - "3000:80"
25
+ networks:
26
+ - evolution-net
27
+
28
+ volumes:
29
+ evolution_instances:
30
+
31
+
32
+ networks:
33
+ evolution-net:
34
+ name: evolution-net
35
+ driver: bridge
docker-compose.yaml ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: "3.8"
2
+
3
+ services:
4
+ api:
5
+ container_name: evolution_api
6
+ image: evoapicloud/evolution-api:latest
7
+ restart: always
8
+ depends_on:
9
+ - redis
10
+ - evolution-postgres
11
+ ports:
12
+ - "8080:8080"
13
+ volumes:
14
+ - evolution_instances:/evolution/instances
15
+ networks:
16
+ - evolution-net
17
+ env_file:
18
+ - .env
19
+ expose:
20
+ - "8080"
21
+
22
+ redis:
23
+ container_name: evolution_redis
24
+ image: redis:latest
25
+ restart: always
26
+ command: >
27
+ redis-server --port 6379 --appendonly yes
28
+ volumes:
29
+ - evolution_redis:/data
30
+ networks:
31
+ evolution-net:
32
+ aliases:
33
+ - evolution-redis
34
+ expose:
35
+ - "6379"
36
+
37
+ evolution-postgres:
38
+ container_name: evolution_postgres
39
+ image: postgres:15
40
+ restart: always
41
+ env_file:
42
+ - .env
43
+ command:
44
+ - postgres
45
+ - -c
46
+ - max_connections=1000
47
+ - -c
48
+ - listen_addresses=*
49
+ environment:
50
+ - POSTGRES_DB=${POSTGRES_DATABASE}
51
+ - POSTGRES_USER=${POSTGRES_USERNAME}
52
+ - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
53
+ volumes:
54
+ - postgres_data:/var/lib/postgresql/data
55
+ networks:
56
+ - evolution-net
57
+ expose:
58
+ - "5432"
59
+
60
+ volumes:
61
+ evolution_instances:
62
+ evolution_redis:
63
+ postgres_data:
64
+
65
+ networks:
66
+ evolution-net:
67
+ name: evolution-net
68
+ driver: bridge
env.example ADDED
@@ -0,0 +1,302 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ===========================================
2
+ # EVOLUTION API - CONFIGURAÇÃO DE AMBIENTE
3
+ # ===========================================
4
+
5
+ # ===========================================
6
+ # SERVIDOR
7
+ # ===========================================
8
+ SERVER_NAME=evolution
9
+ SERVER_TYPE=http
10
+ SERVER_PORT=8080
11
+ SERVER_URL=http://localhost:8080
12
+ SERVER_DISABLE_DOCS=false
13
+ SERVER_DISABLE_MANAGER=false
14
+
15
+ # ===========================================
16
+ # CORS
17
+ # ===========================================
18
+ CORS_ORIGIN=*
19
+ CORS_METHODS=POST,GET,PUT,DELETE
20
+ CORS_CREDENTIALS=true
21
+
22
+ # ===========================================
23
+ # SSL (opcional)
24
+ # ===========================================
25
+ SSL_CONF_PRIVKEY=
26
+ SSL_CONF_FULLCHAIN=
27
+
28
+ # ===========================================
29
+ # BANCO DE DADOS
30
+ # ===========================================
31
+ DATABASE_PROVIDER=postgresql
32
+ DATABASE_CONNECTION_URI=postgresql://username:password@localhost:5432/evolution_api
33
+ DATABASE_CONNECTION_CLIENT_NAME=evolution
34
+
35
+ # Configurações de salvamento de dados
36
+ DATABASE_SAVE_DATA_INSTANCE=true
37
+ DATABASE_SAVE_DATA_NEW_MESSAGE=true
38
+ DATABASE_SAVE_MESSAGE_UPDATE=true
39
+ DATABASE_SAVE_DATA_CONTACTS=true
40
+ DATABASE_SAVE_DATA_CHATS=true
41
+ DATABASE_SAVE_DATA_HISTORIC=true
42
+ DATABASE_SAVE_DATA_LABELS=true
43
+ DATABASE_SAVE_IS_ON_WHATSAPP=true
44
+ DATABASE_SAVE_IS_ON_WHATSAPP_DAYS=7
45
+ DATABASE_DELETE_MESSAGE=false
46
+
47
+ # ===========================================
48
+ # REDIS
49
+ # ===========================================
50
+ CACHE_REDIS_ENABLED=true
51
+ CACHE_REDIS_URI=redis://localhost:6379
52
+ CACHE_REDIS_PREFIX_KEY=evolution-cache
53
+ CACHE_REDIS_TTL=604800
54
+ CACHE_REDIS_SAVE_INSTANCES=true
55
+
56
+ # Cache local (fallback)
57
+ CACHE_LOCAL_ENABLED=true
58
+ CACHE_LOCAL_TTL=86400
59
+
60
+ # ===========================================
61
+ # AUTENTICAÇÃO
62
+ # ===========================================
63
+ AUTHENTICATION_API_KEY=BQYHJGJHJ
64
+ AUTHENTICATION_EXPOSE_IN_FETCH_INSTANCES=false
65
+
66
+ # ===========================================
67
+ # LOGS
68
+ # ===========================================
69
+ LOG_LEVEL=ERROR,WARN,DEBUG,INFO,LOG,VERBOSE,DARK,WEBHOOKS,WEBSOCKET
70
+ LOG_COLOR=true
71
+ LOG_BAILEYS=error
72
+
73
+ # ===========================================
74
+ # INSTÂNCIAS
75
+ # ===========================================
76
+ DEL_INSTANCE=false
77
+ DEL_TEMP_INSTANCES=true
78
+
79
+ # ===========================================
80
+ # IDIOMA
81
+ # ===========================================
82
+ LANGUAGE=pt-BR
83
+
84
+ # ===========================================
85
+ # WEBHOOK
86
+ # ===========================================
87
+ WEBHOOK_GLOBAL_URL=
88
+ WEBHOOK_GLOBAL_ENABLED=false
89
+ WEBHOOK_GLOBAL_WEBHOOK_BY_EVENTS=false
90
+
91
+ # Eventos de webhook
92
+ WEBHOOK_EVENTS_APPLICATION_STARTUP=false
93
+ WEBHOOK_EVENTS_INSTANCE_CREATE=false
94
+ WEBHOOK_EVENTS_INSTANCE_DELETE=false
95
+ WEBHOOK_EVENTS_QRCODE_UPDATED=false
96
+ WEBHOOK_EVENTS_MESSAGES_SET=false
97
+ WEBHOOK_EVENTS_MESSAGES_UPSERT=false
98
+ WEBHOOK_EVENTS_MESSAGES_EDITED=false
99
+ WEBHOOK_EVENTS_MESSAGES_UPDATE=false
100
+ WEBHOOK_EVENTS_MESSAGES_DELETE=false
101
+ WEBHOOK_EVENTS_SEND_MESSAGE=false
102
+ WEBHOOK_EVENTS_SEND_MESSAGE_UPDATE=false
103
+ WEBHOOK_EVENTS_CONTACTS_SET=false
104
+ WEBHOOK_EVENTS_CONTACTS_UPDATE=false
105
+ WEBHOOK_EVENTS_CONTACTS_UPSERT=false
106
+ WEBHOOK_EVENTS_PRESENCE_UPDATE=false
107
+ WEBHOOK_EVENTS_CHATS_SET=false
108
+ WEBHOOK_EVENTS_CHATS_UPDATE=false
109
+ WEBHOOK_EVENTS_CHATS_UPSERT=false
110
+ WEBHOOK_EVENTS_CHATS_DELETE=false
111
+ WEBHOOK_EVENTS_CONNECTION_UPDATE=false
112
+ WEBHOOK_EVENTS_LABELS_EDIT=false
113
+ WEBHOOK_EVENTS_LABELS_ASSOCIATION=false
114
+ WEBHOOK_EVENTS_GROUPS_UPSERT=false
115
+ WEBHOOK_EVENTS_GROUPS_UPDATE=false
116
+ WEBHOOK_EVENTS_GROUP_PARTICIPANTS_UPDATE=false
117
+ WEBHOOK_EVENTS_CALL=false
118
+ WEBHOOK_EVENTS_TYPEBOT_START=false
119
+ WEBHOOK_EVENTS_TYPEBOT_CHANGE_STATUS=false
120
+ WEBHOOK_EVENTS_ERRORS=false
121
+ WEBHOOK_EVENTS_ERRORS_WEBHOOK=
122
+
123
+ # Configurações de webhook
124
+ WEBHOOK_REQUEST_TIMEOUT_MS=30000
125
+ WEBHOOK_RETRY_MAX_ATTEMPTS=10
126
+ WEBHOOK_RETRY_INITIAL_DELAY_SECONDS=5
127
+ WEBHOOK_RETRY_USE_EXPONENTIAL_BACKOFF=true
128
+ WEBHOOK_RETRY_MAX_DELAY_SECONDS=300
129
+ WEBHOOK_RETRY_JITTER_FACTOR=0.2
130
+ WEBHOOK_RETRY_NON_RETRYABLE_STATUS_CODES=400,401,403,404,422
131
+
132
+ # ===========================================
133
+ # WEBSOCKET
134
+ # ===========================================
135
+ WEBSOCKET_ENABLED=true
136
+ WEBSOCKET_GLOBAL_EVENTS=true
137
+ WEBSOCKET_ALLOWED_HOSTS=
138
+
139
+ # ===========================================
140
+ # RABBITMQ
141
+ # ===========================================
142
+ RABBITMQ_ENABLED=false
143
+ RABBITMQ_GLOBAL_ENABLED=false
144
+ RABBITMQ_PREFIX_KEY=
145
+ RABBITMQ_EXCHANGE_NAME=evolution_exchange
146
+ RABBITMQ_URI=
147
+ RABBITMQ_FRAME_MAX=8192
148
+
149
+ # ===========================================
150
+ # NATS
151
+ # ===========================================
152
+ NATS_ENABLED=false
153
+ NATS_GLOBAL_ENABLED=false
154
+ NATS_PREFIX_KEY=
155
+ NATS_EXCHANGE_NAME=evolution_exchange
156
+ NATS_URI=
157
+
158
+ # ===========================================
159
+ # SQS
160
+ # ===========================================
161
+ SQS_ENABLED=false
162
+ SQS_GLOBAL_ENABLED=false
163
+ SQS_GLOBAL_FORCE_SINGLE_QUEUE=false
164
+ SQS_GLOBAL_PREFIX_NAME=global
165
+ SQS_ACCESS_KEY_ID=
166
+ SQS_SECRET_ACCESS_KEY=
167
+ SQS_ACCOUNT_ID=
168
+ SQS_REGION=
169
+ SQS_MAX_PAYLOAD_SIZE=1048576
170
+
171
+ # ===========================================
172
+ # PUSHER
173
+ # ===========================================
174
+ PUSHER_ENABLED=false
175
+ PUSHER_GLOBAL_ENABLED=false
176
+ PUSHER_GLOBAL_APP_ID=
177
+ PUSHER_GLOBAL_KEY=
178
+ PUSHER_GLOBAL_SECRET=
179
+ PUSHER_GLOBAL_CLUSTER=
180
+ PUSHER_GLOBAL_USE_TLS=false
181
+
182
+ # ===========================================
183
+ # WHATSAPP BUSINESS
184
+ # ===========================================
185
+ WA_BUSINESS_TOKEN_WEBHOOK=evolution
186
+ WA_BUSINESS_URL=https://graph.facebook.com
187
+ WA_BUSINESS_VERSION=v18.0
188
+ WA_BUSINESS_LANGUAGE=en
189
+
190
+ # ===========================================
191
+ # CONFIGURAÇÕES DE SESSÃO
192
+ # ===========================================
193
+ CONFIG_SESSION_PHONE_CLIENT=Evolution API
194
+ CONFIG_SESSION_PHONE_NAME=Chrome
195
+
196
+ # ===========================================
197
+ # QR CODE
198
+ # ===========================================
199
+ QRCODE_LIMIT=30
200
+ QRCODE_COLOR=#198754
201
+
202
+ # ===========================================
203
+ # INTEGRAÇÕES
204
+ # ===========================================
205
+
206
+ # Typebot
207
+ TYPEBOT_ENABLED=false
208
+ TYPEBOT_API_VERSION=old
209
+ TYPEBOT_SEND_MEDIA_BASE64=false
210
+
211
+ # Chatwoot
212
+ CHATWOOT_ENABLED=false
213
+ CHATWOOT_MESSAGE_DELETE=false
214
+ CHATWOOT_MESSAGE_READ=false
215
+ CHATWOOT_BOT_CONTACT=true
216
+ CHATWOOT_IMPORT_DATABASE_CONNECTION_URI=
217
+ CHATWOOT_IMPORT_PLACEHOLDER_MEDIA_MESSAGE=false
218
+
219
+ # OpenAI
220
+ OPENAI_ENABLED=false
221
+ OPENAI_API_KEY_GLOBAL=
222
+
223
+ # Dify
224
+ DIFY_ENABLED=false
225
+
226
+ # N8N
227
+ N8N_ENABLED=false
228
+
229
+ # EvoAI
230
+ EVOAI_ENABLED=false
231
+
232
+ # Flowise
233
+ FLOWISE_ENABLED=false
234
+
235
+ # ===========================================
236
+ # S3 / MINIO
237
+ # ===========================================
238
+ S3_ENABLED=false
239
+ S3_ACCESS_KEY=
240
+ S3_SECRET_KEY=
241
+ S3_ENDPOINT=
242
+ S3_BUCKET=
243
+ S3_PORT=9000
244
+ S3_USE_SSL=false
245
+ S3_REGION=
246
+ S3_SKIP_POLICY=false
247
+ S3_SAVE_VIDEO=false
248
+
249
+ # ===========================================
250
+ # MÉTRICAS
251
+ # ===========================================
252
+ PROMETHEUS_METRICS=false
253
+ METRICS_AUTH_REQUIRED=false
254
+ METRICS_USER=
255
+ METRICS_PASSWORD=
256
+ METRICS_ALLOWED_IPS=
257
+
258
+ # ===========================================
259
+ # TELEMETRIA
260
+ # ===========================================
261
+ TELEMETRY_ENABLED=true
262
+ TELEMETRY_URL=
263
+
264
+ # ===========================================
265
+ # PROXY
266
+ # ===========================================
267
+ PROXY_HOST=
268
+ PROXY_PORT=
269
+ PROXY_PROTOCOL=
270
+ PROXY_USERNAME=
271
+ PROXY_PASSWORD=
272
+
273
+ # ===========================================
274
+ # CONVERSOR DE ÁUDIO
275
+ # ===========================================
276
+ API_AUDIO_CONVERTER=
277
+ API_AUDIO_CONVERTER_KEY=
278
+
279
+ # ===========================================
280
+ # FACEBOOK
281
+ # ===========================================
282
+ FACEBOOK_APP_ID=
283
+ FACEBOOK_CONFIG_ID=
284
+ FACEBOOK_USER_TOKEN=
285
+
286
+ # ===========================================
287
+ # SENTRY
288
+ # ===========================================
289
+ SENTRY_DSN=
290
+
291
+ # ===========================================
292
+ # EVENT EMITTER
293
+ # ===========================================
294
+ EVENT_EMITTER_MAX_LISTENERS=50
295
+
296
+ # ===========================================
297
+ # PROVIDER
298
+ # ===========================================
299
+ PROVIDER_ENABLED=false
300
+ PROVIDER_HOST=
301
+ PROVIDER_PORT=5656
302
+ PROVIDER_PREFIX=evolution
grafana-dashboard.json.example ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "dashboard": {
3
+ "id": null,
4
+ "title": "Evolution API Monitoring",
5
+ "tags": ["evolution-api", "whatsapp", "monitoring"],
6
+ "style": "dark",
7
+ "timezone": "browser",
8
+ "panels": [
9
+ {
10
+ "id": 1,
11
+ "title": "API Status",
12
+ "type": "stat",
13
+ "targets": [
14
+ {
15
+ "expr": "up{job=\"evolution-api\"}",
16
+ "legendFormat": "API Status"
17
+ }
18
+ ],
19
+ "fieldConfig": {
20
+ "defaults": {
21
+ "mappings": [
22
+ {
23
+ "options": {
24
+ "0": {
25
+ "text": "DOWN",
26
+ "color": "red"
27
+ },
28
+ "1": {
29
+ "text": "UP",
30
+ "color": "green"
31
+ }
32
+ },
33
+ "type": "value"
34
+ }
35
+ ]
36
+ }
37
+ },
38
+ "gridPos": {
39
+ "h": 8,
40
+ "w": 12,
41
+ "x": 0,
42
+ "y": 0
43
+ }
44
+ },
45
+ {
46
+ "id": 2,
47
+ "title": "Total Instances",
48
+ "type": "stat",
49
+ "targets": [
50
+ {
51
+ "expr": "evolution_instances_total",
52
+ "legendFormat": "Total Instances"
53
+ }
54
+ ],
55
+ "gridPos": {
56
+ "h": 8,
57
+ "w": 12,
58
+ "x": 12,
59
+ "y": 0
60
+ }
61
+ },
62
+ {
63
+ "id": 3,
64
+ "title": "Instance Status Overview",
65
+ "type": "piechart",
66
+ "targets": [
67
+ {
68
+ "expr": "sum by (state) (evolution_instance_state)",
69
+ "legendFormat": "{{ state }}"
70
+ }
71
+ ],
72
+ "gridPos": {
73
+ "h": 9,
74
+ "w": 12,
75
+ "x": 0,
76
+ "y": 8
77
+ }
78
+ },
79
+ {
80
+ "id": 4,
81
+ "title": "Instances by Integration Type",
82
+ "type": "piechart",
83
+ "targets": [
84
+ {
85
+ "expr": "sum by (integration) (evolution_instance_up)",
86
+ "legendFormat": "{{ integration }}"
87
+ }
88
+ ],
89
+ "gridPos": {
90
+ "h": 9,
91
+ "w": 12,
92
+ "x": 12,
93
+ "y": 8
94
+ }
95
+ },
96
+ {
97
+ "id": 5,
98
+ "title": "Instance Uptime",
99
+ "type": "table",
100
+ "targets": [
101
+ {
102
+ "expr": "evolution_instance_up",
103
+ "format": "table",
104
+ "instant": true
105
+ }
106
+ ],
107
+ "transformations": [
108
+ {
109
+ "id": "organize",
110
+ "options": {
111
+ "excludeByName": {
112
+ "Time": true,
113
+ "__name__": true
114
+ },
115
+ "renameByName": {
116
+ "instance": "Instance Name",
117
+ "integration": "Integration Type",
118
+ "Value": "Status"
119
+ }
120
+ }
121
+ }
122
+ ],
123
+ "fieldConfig": {
124
+ "overrides": [
125
+ {
126
+ "matcher": {
127
+ "id": "byName",
128
+ "options": "Status"
129
+ },
130
+ "properties": [
131
+ {
132
+ "id": "mappings",
133
+ "value": [
134
+ {
135
+ "options": {
136
+ "0": {
137
+ "text": "DOWN",
138
+ "color": "red"
139
+ },
140
+ "1": {
141
+ "text": "UP",
142
+ "color": "green"
143
+ }
144
+ },
145
+ "type": "value"
146
+ }
147
+ ]
148
+ }
149
+ ]
150
+ }
151
+ ]
152
+ },
153
+ "gridPos": {
154
+ "h": 9,
155
+ "w": 24,
156
+ "x": 0,
157
+ "y": 17
158
+ }
159
+ },
160
+ {
161
+ "id": 6,
162
+ "title": "Instance Status Timeline",
163
+ "type": "timeseries",
164
+ "targets": [
165
+ {
166
+ "expr": "evolution_instance_up",
167
+ "legendFormat": "{{ instance }} ({{ integration }})"
168
+ }
169
+ ],
170
+ "fieldConfig": {
171
+ "defaults": {
172
+ "custom": {
173
+ "drawStyle": "line",
174
+ "lineInterpolation": "stepAfter",
175
+ "lineWidth": 2,
176
+ "fillOpacity": 10,
177
+ "gradientMode": "none",
178
+ "spanNulls": false,
179
+ "insertNulls": false,
180
+ "showPoints": "never",
181
+ "pointSize": 5,
182
+ "stacking": {
183
+ "mode": "none",
184
+ "group": "A"
185
+ },
186
+ "axisPlacement": "auto",
187
+ "axisLabel": "",
188
+ "scaleDistribution": {
189
+ "type": "linear"
190
+ },
191
+ "hideFrom": {
192
+ "legend": false,
193
+ "tooltip": false,
194
+ "vis": false
195
+ },
196
+ "thresholdsStyle": {
197
+ "mode": "off"
198
+ }
199
+ },
200
+ "min": 0,
201
+ "max": 1
202
+ }
203
+ },
204
+ "gridPos": {
205
+ "h": 8,
206
+ "w": 24,
207
+ "x": 0,
208
+ "y": 26
209
+ }
210
+ }
211
+ ],
212
+ "time": {
213
+ "from": "now-1h",
214
+ "to": "now"
215
+ },
216
+ "timepicker": {},
217
+ "templating": {
218
+ "list": []
219
+ },
220
+ "annotations": {
221
+ "list": [
222
+ {
223
+ "builtIn": 1,
224
+ "datasource": "-- Grafana --",
225
+ "enable": true,
226
+ "hide": true,
227
+ "iconColor": "rgba(0, 211, 255, 1)",
228
+ "name": "Annotations & Alerts",
229
+ "type": "dashboard"
230
+ }
231
+ ]
232
+ },
233
+ "refresh": "30s",
234
+ "schemaVersion": 27,
235
+ "version": 0,
236
+ "links": []
237
+ }
238
+ }
local_install.sh ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # Definir cores para melhor legibilidade
4
+ RED='\033[0;31m'
5
+ GREEN='\033[0;32m'
6
+ YELLOW='\033[1;33m'
7
+ NC='\033[0m' # No Color
8
+
9
+ # Função para log
10
+ log() {
11
+ echo -e "${GREEN}[INFO]${NC} $1"
12
+ }
13
+ log_error() {
14
+ echo -e "${RED}[ERROR]${NC} $1"
15
+ }
16
+ log_warning() {
17
+ echo -e "${YELLOW}[WARNING]${NC} $1"
18
+ }
19
+
20
+ # Verificar se está rodando como root
21
+ if [ "$(id -u)" = "0" ]; then
22
+ log_error "Este script não deve ser executado como root"
23
+ exit 1
24
+ fi
25
+
26
+ # Verificar sistema operacional
27
+ OS="$(uname -s)"
28
+ case "${OS}" in
29
+ Linux*)
30
+ if [ ! -x "$(command -v curl)" ]; then
31
+ log_warning "Curl não está instalado. Tentando instalar..."
32
+ if [ -x "$(command -v apt-get)" ]; then
33
+ sudo apt-get update && sudo apt-get install -y curl
34
+ elif [ -x "$(command -v yum)" ]; then
35
+ sudo yum install -y curl
36
+ else
37
+ log_error "Não foi possível instalar curl automaticamente. Por favor, instale manualmente."
38
+ exit 1
39
+ fi
40
+ fi
41
+ ;;
42
+ Darwin*)
43
+ if [ ! -x "$(command -v curl)" ]; then
44
+ log_error "Curl não está instalado. Por favor, instale o Xcode Command Line Tools."
45
+ exit 1
46
+ fi
47
+ ;;
48
+ *)
49
+ log_error "Sistema operacional não suportado: ${OS}"
50
+ exit 1
51
+ ;;
52
+ esac
53
+
54
+ # Verificar conexão com a internet antes de prosseguir
55
+ if ! ping -c 1 8.8.8.8 &> /dev/null; then
56
+ log_error "Sem conexão com a internet. Por favor, verifique sua conexão."
57
+ exit 1
58
+ fi
59
+
60
+ # Adicionar verificação de espaço em disco
61
+ REQUIRED_SPACE=1000000 # 1GB em KB
62
+ AVAILABLE_SPACE=$(df -k . | awk 'NR==2 {print $4}')
63
+ if [ $AVAILABLE_SPACE -lt $REQUIRED_SPACE ]; then
64
+ log_error "Espaço em disco insuficiente. Necessário pelo menos 1GB livre."
65
+ exit 1
66
+ fi
67
+
68
+ # Adicionar tratamento de erro para comandos npm
69
+ npm_install_with_retry() {
70
+ local max_attempts=3
71
+ local attempt=1
72
+
73
+ while [ $attempt -le $max_attempts ]; do
74
+ log "Tentativa $attempt de $max_attempts para npm install"
75
+ if npm install; then
76
+ return 0
77
+ fi
78
+ attempt=$((attempt + 1))
79
+ [ $attempt -le $max_attempts ] && log_warning "Falha na instalação. Tentando novamente em 5 segundos..." && sleep 5
80
+ done
81
+
82
+ log_error "Falha ao executar npm install após $max_attempts tentativas"
83
+ return 1
84
+ }
85
+
86
+ # Adicionar timeout para comandos
87
+ execute_with_timeout() {
88
+ timeout 300 $@ || log_error "Comando excedeu o tempo limite de 5 minutos: $@"
89
+ }
90
+
91
+ # Verificar se o NVM já está instalado
92
+ if [ -d "$HOME/.nvm" ]; then
93
+ log "NVM já está instalado."
94
+ else
95
+ log "Instalando NVM..."
96
+ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
97
+ fi
98
+
99
+ # Carregar o NVM no ambiente atual
100
+ export NVM_DIR="$HOME/.nvm"
101
+ [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
102
+ [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
103
+
104
+ # Verificar se a versão do Node.js já está instalada
105
+ if command -v node >/dev/null 2>&1 && [ "$(node -v)" = "v20.10.0" ]; then
106
+ log "Node.js v20.10.0 já está instalado."
107
+ else
108
+ log "Instalando Node.js v20.10.0..."
109
+ nvm install v20.10.0
110
+ fi
111
+
112
+ nvm use v20.10.0
113
+
114
+ # Verificar as versões instaladas
115
+ log "Verificando as versões instaladas:"
116
+ log "Node.js: $(node -v)"
117
+ log "npm: $(npm -v)"
118
+
119
+ # Instala dependências do projeto
120
+ log "Instalando dependências do projeto..."
121
+ rm -rf node_modules
122
+ npm install
123
+
124
+ # Deploy do banco de dados
125
+ log "Deploy do banco de dados..."
126
+ npm run db:generate
127
+ npm run db:deploy
128
+
129
+ # Iniciar o projeto
130
+ log "Iniciando o projeto..."
131
+ if [ "$1" = "-dev" ]; then
132
+ npm run dev:server
133
+ else
134
+ npm run build
135
+ npm run start:prod
136
+ fi
137
+
138
+ log "Instalação concluída com sucesso!"
139
+
140
+ # Criar arquivo de log
141
+ LOGFILE="./installation_log_$(date +%Y%m%d_%H%M%S).log"
142
+ exec 1> >(tee -a "$LOGFILE")
143
+ exec 2>&1
144
+
145
+ # Adicionar trap para limpeza em caso de interrupção
146
+ cleanup() {
147
+ log "Limpando recursos temporários..."
148
+ # Adicione comandos de limpeza aqui
149
+ }
150
+ trap cleanup EXIT
manager_install.sh ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #! /bin/bash
2
+
3
+ cd evolution-manager-v2
4
+ npm install
5
+ npm run build
6
+ cd ..
7
+ rm -rf manager/dist
8
+ cp -r evolution-manager-v2/dist manager/dist
package-lock.json ADDED
The diff for this file is too large to render. See raw diff
 
prometheus.yml.example ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Prometheus configuration example for Evolution API
2
+ # Copy this file to prometheus.yml and adjust the settings
3
+
4
+ global:
5
+ scrape_interval: 15s
6
+ evaluation_interval: 15s
7
+
8
+ rule_files:
9
+ # - "first_rules.yml"
10
+ # - "second_rules.yml"
11
+
12
+ scrape_configs:
13
+ # Evolution API metrics
14
+ - job_name: 'evolution-api'
15
+ static_configs:
16
+ - targets: ['localhost:8080'] # Adjust to your Evolution API URL
17
+
18
+ # Metrics endpoint path
19
+ metrics_path: '/metrics'
20
+
21
+ # Scrape interval for this job
22
+ scrape_interval: 30s
23
+
24
+ # Basic authentication (if METRICS_AUTH_REQUIRED=true)
25
+ basic_auth:
26
+ username: 'prometheus' # Should match METRICS_USER
27
+ password: 'secure_random_password_here' # Should match METRICS_PASSWORD
28
+
29
+ # Optional: Add custom labels
30
+ relabel_configs:
31
+ - source_labels: [__address__]
32
+ target_label: __param_target
33
+ - source_labels: [__param_target]
34
+ target_label: instance
35
+ - target_label: __address__
36
+ replacement: localhost:8080 # Evolution API address
37
+
38
+ # Alerting configuration (optional)
39
+ alerting:
40
+ alertmanagers:
41
+ - static_configs:
42
+ - targets:
43
+ # - alertmanager:9093
44
+
45
+ # Example alert rules for Evolution API
46
+ # Create a file called evolution_alerts.yml with these rules:
47
+ #
48
+ # groups:
49
+ # - name: evolution-api
50
+ # rules:
51
+ # - alert: EvolutionAPIDown
52
+ # expr: up{job="evolution-api"} == 0
53
+ # for: 1m
54
+ # labels:
55
+ # severity: critical
56
+ # annotations:
57
+ # summary: "Evolution API is down"
58
+ # description: "Evolution API has been down for more than 1 minute."
59
+ #
60
+ # - alert: EvolutionInstanceDown
61
+ # expr: evolution_instance_up == 0
62
+ # for: 2m
63
+ # labels:
64
+ # severity: warning
65
+ # annotations:
66
+ # summary: "Evolution instance {{ $labels.instance }} is down"
67
+ # description: "Instance {{ $labels.instance }} has been down for more than 2 minutes."
68
+ #
69
+ # - alert: HighInstanceCount
70
+ # expr: evolution_instances_total > 100
71
+ # for: 5m
72
+ # labels:
73
+ # severity: warning
74
+ # annotations:
75
+ # summary: "High number of Evolution instances"
76
+ # description: "Evolution API is managing {{ $value }} instances."
runWithProvider.js ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const dotenv = require('dotenv');
2
+ const { execSync } = require('child_process');
3
+ const { existsSync } = require('fs');
4
+
5
+ dotenv.config();
6
+
7
+ const { DATABASE_PROVIDER } = process.env;
8
+ const databaseProviderDefault = DATABASE_PROVIDER ?? 'postgresql';
9
+
10
+ if (!DATABASE_PROVIDER) {
11
+ console.warn(`DATABASE_PROVIDER is not set in the .env file, using default: ${databaseProviderDefault}`);
12
+ }
13
+
14
+ // Função para determinar qual pasta de migrations usar
15
+ // Função para determinar qual pasta de migrations usar
16
+ function getMigrationsFolder(provider) {
17
+ switch (provider) {
18
+ case 'psql_bouncer':
19
+ return 'postgresql-migrations'; // psql_bouncer usa as migrations do postgresql
20
+ default:
21
+ return `${provider}-migrations`;
22
+ }
23
+ }
24
+
25
+ const migrationsFolder = getMigrationsFolder(databaseProviderDefault);
26
+
27
+ let command = process.argv
28
+ .slice(2)
29
+ .join(' ')
30
+ .replace(/DATABASE_PROVIDER/g, databaseProviderDefault);
31
+
32
+ // Substituir referências à pasta de migrations pela pasta correta
33
+ const migrationsPattern = new RegExp(`${databaseProviderDefault}-migrations`, 'g');
34
+ command = command.replace(migrationsPattern, migrationsFolder);
35
+
36
+ if (command.includes('rmdir') && existsSync('prisma\\migrations')) {
37
+ try {
38
+ execSync('rmdir /S /Q prisma\\migrations', { stdio: 'inherit' });
39
+ } catch (error) {
40
+ console.error(`Error removing directory: prisma\\migrations`);
41
+ process.exit(1);
42
+ }
43
+ } else if (command.includes('rmdir')) {
44
+ console.warn(`Directory 'prisma\\migrations' does not exist, skipping removal.`);
45
+ }
46
+
47
+ try {
48
+ execSync(command, { stdio: 'inherit' });
49
+ } catch (error) {
50
+ console.error(`Error executing command: ${command}`);
51
+ process.exit(1);
52
+ }
tsconfig.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "compilerOptions": {
3
+ "experimentalDecorators": true,
4
+ "emitDecoratorMetadata": true,
5
+ "declaration": true,
6
+ "target": "es2020",
7
+ "module": "CommonJS",
8
+ "rootDir": "./",
9
+ "resolveJsonModule": true,
10
+ "removeComments": true,
11
+ "outDir": "./dist",
12
+ "noEmitOnError": true,
13
+ "esModuleInterop": true,
14
+ "forceConsistentCasingInFileNames": true,
15
+ "strict": false,
16
+ "skipLibCheck": true,
17
+ "strictNullChecks": false,
18
+ "incremental": true,
19
+ "noImplicitAny": false,
20
+ "baseUrl": ".",
21
+ "paths": {
22
+ "@api/*": ["./src/api/*"],
23
+ "@cache/*": ["./src/cache/*"],
24
+ "@config/*": ["./src/config/*"],
25
+ "@exceptions": ["./src/exceptions"],
26
+ "@libs/*": ["./src/libs/*"],
27
+ "@utils/*": ["./src/utils/*"],
28
+ "@validate/*": ["./src/validate/*"]
29
+ },
30
+ "moduleResolution": "Node"
31
+ },
32
+ "exclude": ["node_modules", "./test", "./dist", "./prisma"],
33
+ "include": [
34
+ "src/**/*",
35
+ "src/**/*.json"
36
+ ]
37
+ }
tsup.config.ts ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { cpSync } from 'node:fs';
2
+
3
+ import { defineConfig } from 'tsup';
4
+
5
+ export default defineConfig({
6
+ entry: ['src'],
7
+ outDir: 'dist',
8
+ splitting: false,
9
+ sourcemap: true,
10
+ clean: true,
11
+ minify: true,
12
+ format: ['cjs', 'esm'],
13
+ onSuccess: async () => {
14
+ cpSync('src/utils/translations', 'dist/translations', { recursive: true });
15
+ },
16
+ loader: {
17
+ '.json': 'file',
18
+ '.yml': 'file',
19
+ },
20
+ });