feat: Improved fetch instances endpoint and prepare changelog to version 1.1.0 in homolog

This commit is contained in:
Davidson Gomes 2023-06-10 18:56:11 -03:00
parent f067cb99c8
commit ae1c5908ae
4 changed files with 36 additions and 17 deletions

View File

@ -1,3 +1,14 @@
# 1.1.0 (homolog)
### Features
* Improved fetch instances endpoint, now it also fetch other instances even if they are not connected
### Fixed
* Adjust dockerfile variables
* tweaks in docker-compose to pass variables
# 1.0.9 (2023-06-10) # 1.0.9 (2023-06-10)
### Fixed ### Fixed

View File

@ -65,7 +65,7 @@ ENV WEBHOOK_EVENTS_GROUP_PARTICIPANTS_UPDATE=$WEBHOOK_EVENTS_GROUP_PARTICIPANTS_
ENV WEBHOOK_EVENTS_NEW_JWT_TOKEN=$WEBHOOK_EVENTS_NEW_JWT_TOKEN ENV WEBHOOK_EVENTS_NEW_JWT_TOKEN=$WEBHOOK_EVENTS_NEW_JWT_TOKEN
ENV CONFIG_SESSION_PHONE_CLIENT=$CONFIG_SESSION_PHONE_CLIENT ENV CONFIG_SESSION_PHONE_CLIENT=$CONFIG_SESSION_PHONE_CLIENT
ENV CONFIG_SESSION_PHONE_NAME=Chrome ENV CONFIG_SESSION_PHONE_NAME="Chrome"
ENV QRCODE_LIMIT=$QRCODE_LIMIT ENV QRCODE_LIMIT=$QRCODE_LIMIT

View File

@ -7,14 +7,13 @@ networks:
services: services:
api: api:
container_name: evolution_api container_name: evolution_api
# image: davidsongomes/evolution-api:v1.0.9
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
ports: ports:
- 8080:8080 - 8080:8080
volumes: volumes:
- /Users/davidson/Projects/atendai-api/instances:/evolution/instances - /data/instances:/evolution/instances
environment: environment:
# Determine how long the instance should be deleted from memory in case of no connection. # Determine how long the instance should be deleted from memory in case of no connection.
# Default time: 5 minutes # Default time: 5 minutes
@ -41,7 +40,7 @@ services:
- REDIS_PREFIX_KEY=evolution - REDIS_PREFIX_KEY=evolution
# Webhook Settings # Webhook Settings
# Define a global webhook that will listen for enabled events from all instances # Define a global webhook that will listen for enabled events from all instances
- WEBHOOK_GLOBAL_URL=https://webhooks.n8n.evolution-api.com/webhook/0e66d93a-1671-474f-a07f-3f44b581d320 - WEBHOOK_GLOBAL_URL=url
- WEBHOOK_GLOBAL_ENABLED=false - WEBHOOK_GLOBAL_ENABLED=false
# With this option activated, you work with a url per webhook event, respecting the global url and the name of each event # With this option activated, you work with a url per webhook event, respecting the global url and the name of each event
- WEBHOOK_GLOBAL_WEBHOOK_BY_EVENTS=false - WEBHOOK_GLOBAL_WEBHOOK_BY_EVENTS=false
@ -84,7 +83,7 @@ services:
- AUTHENTICATION_INSTANCE_MODE=server # container or server - AUTHENTICATION_INSTANCE_MODE=server # container or server
# if you are using container mode, set the container name and the webhook url to default instance # if you are using container mode, set the container name and the webhook url to default instance
- AUTHENTICATION_INSTANCE_NAME=evolution - AUTHENTICATION_INSTANCE_NAME=evolution
- AUTHENTICATION_INSTANCE_WEBHOOK_URL=https://webhooks.n8n.evolution-api.com/webhook/0e66d93a-1671-474f-a07f-3f44b581d320 - AUTHENTICATION_INSTANCE_WEBHOOK_URL=url
command: ['node', './dist/src/main.js'] command: ['node', './dist/src/main.js']
networks: networks:
- evolution-net - evolution-net
@ -96,7 +95,7 @@ services:
image: mongo image: mongo
restart: always restart: always
volumes: volumes:
- /Users/davidson/Projects/atendai-api/docker-compose-data/mongodb:/data/db - /data/mongodb:/data/db
ports: ports:
- 27017:27017 - 27017:27017
environment: environment:
@ -112,7 +111,7 @@ services:
image: redis:latest image: redis:latest
restart: always restart: always
volumes: volumes:
- /Users/davidson/Projects/atendai-api/docker-compose-data/redis:/data - /data/redis:/data
ports: ports:
- 6379:6379 - 6379:6379
networks: networks:

View File

@ -60,16 +60,25 @@ export class WAMonitoringService {
const instances: any[] = []; const instances: any[] = [];
for await (const [key, value] of Object.entries(this.waInstances)) { for await (const [key, value] of Object.entries(this.waInstances)) {
if (value && value.connectionStatus.state === 'open') { if (value) {
instances.push({ if (value.connectionStatus.state === 'open') {
instance: { instances.push({
instanceName: key, instance: {
owner: value.wuid, instanceName: key,
profileName: (await value.getProfileName()) || 'not loaded', owner: value.wuid,
profilePictureUrl: value.profilePictureUrl, profileName: (await value.getProfileName()) || 'not loaded',
status: (await value.getProfileStatus()) || '', profilePictureUrl: value.profilePictureUrl,
}, status: (await value.getProfileStatus()) || '',
}); },
});
} else {
instances.push({
instance: {
instanceName: key,
status: value.connectionStatus.state,
},
});
}
} }
} }