mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-19 03:42:23 -06:00
Enhance settings and integrate Baileys controller for WhatsApp functionality
- Added `wavoipToken` field to `Setting` model in both MySQL and PostgreSQL schemas. - Updated `package.json` and `package-lock.json` to include `mime-types` and `socket.io-client` dependencies. - Introduced `BaileysController` and `BaileysRouter` for handling WhatsApp interactions. - Refactored media type handling to use `mime-types` instead of `mime` across various services. - Updated DTOs and validation schemas to accommodate the new `wavoipToken` field. - Implemented voice call functionalities using the Wavoip service in the Baileys integration. - Enhanced event handling in the WebSocket controller to support new features.
This commit is contained in:
@@ -151,6 +151,7 @@ export class ChannelStartupService {
|
||||
this.localSettings.readMessages = data?.readMessages;
|
||||
this.localSettings.readStatus = data?.readStatus;
|
||||
this.localSettings.syncFullHistory = data?.syncFullHistory;
|
||||
this.localSettings.wavoipToken = data?.wavoipToken;
|
||||
}
|
||||
|
||||
public async setSettings(data: SettingsDto) {
|
||||
@@ -166,6 +167,7 @@ export class ChannelStartupService {
|
||||
readMessages: data.readMessages,
|
||||
readStatus: data.readStatus,
|
||||
syncFullHistory: data.syncFullHistory,
|
||||
wavoipToken: data.wavoipToken,
|
||||
},
|
||||
create: {
|
||||
rejectCall: data.rejectCall,
|
||||
@@ -175,6 +177,7 @@ export class ChannelStartupService {
|
||||
readMessages: data.readMessages,
|
||||
readStatus: data.readStatus,
|
||||
syncFullHistory: data.syncFullHistory,
|
||||
wavoipToken: data.wavoipToken,
|
||||
instanceId: this.instanceId,
|
||||
},
|
||||
});
|
||||
@@ -186,6 +189,12 @@ export class ChannelStartupService {
|
||||
this.localSettings.readMessages = data?.readMessages;
|
||||
this.localSettings.readStatus = data?.readStatus;
|
||||
this.localSettings.syncFullHistory = data?.syncFullHistory;
|
||||
this.localSettings.wavoipToken = data?.wavoipToken;
|
||||
|
||||
if (this.localSettings.wavoipToken && this.localSettings.wavoipToken.length > 0) {
|
||||
this.client.ws.close();
|
||||
this.client.ws.connect();
|
||||
}
|
||||
}
|
||||
|
||||
public async findSettings() {
|
||||
@@ -207,6 +216,7 @@ export class ChannelStartupService {
|
||||
readMessages: data.readMessages,
|
||||
readStatus: data.readStatus,
|
||||
syncFullHistory: data.syncFullHistory,
|
||||
wavoipToken: data.wavoipToken,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -419,7 +429,7 @@ export class ChannelStartupService {
|
||||
return data;
|
||||
}
|
||||
|
||||
public async sendDataWebhook<T = any>(event: Events, data: T, local = true) {
|
||||
public async sendDataWebhook<T = any>(event: Events, data: T, local = true, integration?: string[]) {
|
||||
const serverUrl = this.configService.get<HttpServer>('SERVER').URL;
|
||||
const tzoffset = new Date().getTimezoneOffset() * 60000; //offset in milliseconds
|
||||
const localISOTime = new Date(Date.now() - tzoffset).toISOString();
|
||||
@@ -439,6 +449,7 @@ export class ChannelStartupService {
|
||||
sender: this.wuid,
|
||||
apiKey: expose && instanceApikey ? instanceApikey : null,
|
||||
local,
|
||||
integration,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user