Spaces:
Runtime error
Runtime error
Download src/api/integrations/channel/evolution/evolution.controller.ts from oex2003/evolution-api: direct link, hf CLI and curl.
- Browser
- Download file 1.18 kB
-
https://huggingface.co/spaces/oex2003/evolution-api/resolve/refs%2Fpr%2F1/src/api/integrations/channel/evolution/evolution.controller.ts
- Command line
-
hf download hf://spaces/oex2003/evolution-api@refs/pr/1/src/api/integrations/channel/evolution/evolution.controller.ts
-
curl -L -o evolution.controller.ts https://huggingface.co/spaces/oex2003/evolution-api/resolve/refs%2Fpr%2F1/src/api/integrations/channel/evolution/evolution.controller.ts
1.18 kB
| import { PrismaRepository } from '@api/repository/repository.service'; | |
| import { WAMonitoringService } from '@api/services/monitor.service'; | |
| import { Logger } from '@config/logger.config'; | |
| import { ChannelController, ChannelControllerInterface } from '../channel.controller'; | |
| export class EvolutionController extends ChannelController implements ChannelControllerInterface { | |
| private readonly logger = new Logger('EvolutionController'); | |
| constructor(prismaRepository: PrismaRepository, waMonitor: WAMonitoringService) { | |
| super(prismaRepository, waMonitor); | |
| } | |
| integrationEnabled: boolean; | |
| public async receiveWebhook(data: any) { | |
| const numberId = data.numberId; | |
| if (!numberId) { | |
| this.logger.error('WebhookService -> receiveWebhookEvolution -> numberId not found'); | |
| return; | |
| } | |
| const instance = await this.prismaRepository.instance.findFirst({ | |
| where: { number: numberId }, | |
| }); | |
| if (!instance) { | |
| this.logger.error('WebhookService -> receiveWebhook -> instance not found'); | |
| return; | |
| } | |
| await this.waMonitor.waInstances[instance.name].connectToWhatsapp(data); | |
| return { | |
| status: 'success', | |
| }; | |
| } | |
| } | |