mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-19 11:52:20 -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:
@@ -35,6 +35,16 @@ export class WebsocketController extends EventController implements EventControl
|
||||
socket.on('disconnect', () => {
|
||||
this.logger.info('User disconnected');
|
||||
});
|
||||
|
||||
socket.on('sendNode', async (data) => {
|
||||
try {
|
||||
await this.waMonitor.waInstances[data.instanceId].baileysSendNode(data.stanza);
|
||||
this.logger.info('Node sent successfully');
|
||||
} catch (error) {
|
||||
this.logger.error('Error sending node:');
|
||||
this.logger.error(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
this.logger.info('Socket.io initialized');
|
||||
@@ -65,7 +75,12 @@ export class WebsocketController extends EventController implements EventControl
|
||||
dateTime,
|
||||
sender,
|
||||
apiKey,
|
||||
integration,
|
||||
}: EmitData): Promise<void> {
|
||||
if (integration && !integration.includes('websocket')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.status) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user