mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-25 06:37:45 -06:00
init project evolution api
This commit is contained in:
21
src/whatsapp/services/webhook.service.ts
Normal file
21
src/whatsapp/services/webhook.service.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { InstanceDto } from '../dto/instance.dto';
|
||||
import { WebhookDto } from '../dto/webhook.dto';
|
||||
import { WAMonitoringService } from './monitor.service';
|
||||
|
||||
export class WebhookService {
|
||||
constructor(private readonly waMonitor: WAMonitoringService) {}
|
||||
|
||||
public create(instance: InstanceDto, data: WebhookDto) {
|
||||
this.waMonitor.waInstances[instance.instanceName].setWebhook(data);
|
||||
|
||||
return { webhook: { ...instance, webhook: data } };
|
||||
}
|
||||
|
||||
public async find(instance: InstanceDto): Promise<WebhookDto> {
|
||||
try {
|
||||
return await this.waMonitor.waInstances[instance.instanceName].findWebhook();
|
||||
} catch (error) {
|
||||
return { enabled: null, url: '' };
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user