Skip to content

Commit b58d9e9

Browse files
committed
Merge branch 'develop' of github.com:EvolutionAPI/evolution-api into develop
2 parents d665474 + e5137e1 commit b58d9e9

19 files changed

+159
-84
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
.git
22
*Dockerfile*
33
*docker-compose*
4+
package-lock.json
5+
.env
46
node_modules
57
dist

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM node:20-alpine AS builder
22

33
RUN apk update && \
4-
apk add git ffmpeg wget curl bash openssl
4+
apk add --no-cache git ffmpeg wget curl bash openssl
55

66
LABEL version="2.2.3" description="Api to control whatsapp features through http requests."
77
LABEL maintainer="Davidson Gomes" git="https://github.com/DavidsonGomes"

prisma/mysql-schema.prisma

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ model Instance {
100100
Template Template[]
101101
Dify Dify[]
102102
DifySetting DifySetting?
103-
integrationSessions IntegrationSession[]
103+
IntegrationSession IntegrationSession[]
104104
EvolutionBot EvolutionBot[]
105105
EvolutionBotSetting EvolutionBotSetting?
106106
Flowise Flowise[]

prisma/postgresql-schema.prisma

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ model Instance {
100100
Template Template[]
101101
Dify Dify[]
102102
DifySetting DifySetting?
103-
integrationSessions IntegrationSession[]
103+
IntegrationSession IntegrationSession[]
104104
EvolutionBot EvolutionBot[]
105105
EvolutionBotSetting EvolutionBotSetting?
106106
Flowise Flowise[]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { getCatalogDto, getCollectionsDto } from '@api/dto/business.dto';
2+
import { InstanceDto } from '@api/dto/instance.dto';
3+
import { WAMonitoringService } from '@api/services/monitor.service';
4+
5+
export class BusinessController {
6+
constructor(private readonly waMonitor: WAMonitoringService) {}
7+
8+
public async fetchCatalog({ instanceName }: InstanceDto, data: getCatalogDto) {
9+
return await this.waMonitor.waInstances[instanceName].fetchCatalog(instanceName, data);
10+
}
11+
12+
public async fetchCollections({ instanceName }: InstanceDto, data: getCollectionsDto) {
13+
return await this.waMonitor.waInstances[instanceName].fetchCollections(instanceName, data);
14+
}
15+
}

src/api/controllers/chat.controller.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import {
33
BlockUserDto,
44
DeleteMessage,
55
getBase64FromMediaMessageDto,
6-
getCatalogDto,
7-
getCollectionsDto,
86
MarkChatUnreadDto,
97
NumberDto,
108
PrivacySettingDto,
@@ -111,12 +109,4 @@ export class ChatController {
111109
public async blockUser({ instanceName }: InstanceDto, data: BlockUserDto) {
112110
return await this.waMonitor.waInstances[instanceName].blockUser(data);
113111
}
114-
115-
public async fetchCatalog({ instanceName }: InstanceDto, data: getCatalogDto) {
116-
return await this.waMonitor.waInstances[instanceName].fetchCatalog(instanceName, data);
117-
}
118-
119-
public async fetchCatalogCollections({ instanceName }: InstanceDto, data: getCollectionsDto) {
120-
return await this.waMonitor.waInstances[instanceName].fetchCatalogCollections(instanceName, data);
121-
}
122112
}

src/api/dto/business.dto.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export class NumberDto {
2+
number: string;
3+
}
4+
5+
export class getCatalogDto {
6+
number?: string;
7+
limit?: number;
8+
cursor?: string;
9+
}
10+
11+
export class getCollectionsDto {
12+
number?: string;
13+
limit?: number;
14+
}

src/api/dto/chat.dto.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,3 @@ export class BlockUserDto {
126126
number: string;
127127
status: 'block' | 'unblock';
128128
}
129-
130-
export class getCatalogDto {
131-
number?: string;
132-
limit?: number;
133-
cursor?: string;
134-
}
135-
136-
export class getCollectionsDto {
137-
number?: string;
138-
limit?: number;
139-
}

src/api/dto/sendMessage.dto.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export class Metadata {
4444
mentionsEveryOne?: boolean;
4545
mentioned?: string[];
4646
encoding?: boolean;
47+
notConvertSticker?: boolean;
4748
}
4849

4950
export class SendTextDto extends Metadata {

src/api/integrations/channel/meta/whatsapp.business.service.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,20 @@ export class BusinessStartupService extends ChannelStartupService {
206206
return content;
207207
}
208208

209+
private messageLocationJson(received: any) {
210+
const message = received.messages[0];
211+
let content: any = {
212+
locationMessage: {
213+
degreesLatitude: message.location.latitude,
214+
degreesLongitude: message.location.longitude,
215+
name: message.location?.name,
216+
address: message.location?.address,
217+
},
218+
};
219+
message.context ? (content = { ...content, contextInfo: { stanzaId: message.context.id } }) : content;
220+
return content;
221+
}
222+
209223
private messageContactsJson(received: any) {
210224
const message = received.messages[0];
211225
let content: any = {};
@@ -283,6 +297,9 @@ export class BusinessStartupService extends ChannelStartupService {
283297
case 'template':
284298
messageType = 'conversation';
285299
break;
300+
case 'location':
301+
messageType = 'locationMessage';
302+
break;
286303
default:
287304
messageType = 'conversation';
288305
break;
@@ -438,6 +455,17 @@ export class BusinessStartupService extends ChannelStartupService {
438455
source: 'unknown',
439456
instanceId: this.instanceId,
440457
};
458+
} else if (received?.messages[0].location) {
459+
messageRaw = {
460+
key,
461+
pushName,
462+
message: this.messageLocationJson(received),
463+
contextInfo: this.messageLocationJson(received)?.contextInfo,
464+
messageType: this.renderMessageType(received.messages[0].type),
465+
messageTimestamp: parseInt(received.messages[0].timestamp) as number,
466+
source: 'unknown',
467+
instanceId: this.instanceId,
468+
};
441469
} else {
442470
messageRaw = {
443471
key,

0 commit comments

Comments
 (0)