mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-14 09:51:24 -06:00
Merge pull request #800 from dev-luizf/fix/manage-webhook
Fix webhook creation
This commit is contained in:
commit
b58ad83c12
@ -30,27 +30,24 @@ export class WebhookController extends EventController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
await this.get(instanceName);
|
||||||
await this.get(instanceName);
|
|
||||||
|
|
||||||
return this.prisma.webhook.update({
|
return this.prisma.webhook.upsert({
|
||||||
where: {
|
where: {
|
||||||
instanceId: this.monitor.waInstances[instanceName].instanceId,
|
instanceId: this.monitor.waInstances[instanceName].instanceId,
|
||||||
},
|
},
|
||||||
data,
|
update: {
|
||||||
});
|
...data,
|
||||||
} catch (err) {
|
},
|
||||||
return this.prisma.webhook.create({
|
create: {
|
||||||
data: {
|
enabled: data.enabled,
|
||||||
enabled: data.enabled,
|
events: data.events,
|
||||||
events: data.events,
|
instanceId: this.monitor.waInstances[instanceName].instanceId,
|
||||||
instanceId: this.monitor.waInstances[instanceName].instanceId,
|
url: data.url,
|
||||||
url: data.url,
|
webhookBase64: data.webhookBase64,
|
||||||
webhookBase64: data.webhookBase64,
|
webhookByEvents: data.webhookByEvents,
|
||||||
webhookByEvents: data.webhookByEvents,
|
},
|
||||||
},
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async get(instanceName: string): Promise<wa.LocalWebHook> {
|
public async get(instanceName: string): Promise<wa.LocalWebHook> {
|
||||||
|
Loading…
Reference in New Issue
Block a user