From f3a0000c24f00dda83ea5904040a6972c6df3269 Mon Sep 17 00:00:00 2001 From: nael Date: Sat, 16 Dec 2023 15:57:33 +0100 Subject: [PATCH] :sparkles: Added webhook when contact is created --- .../api/src/crm/contact/services/contact.service.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/api/src/crm/contact/services/contact.service.ts b/packages/api/src/crm/contact/services/contact.service.ts index b269ed8c4..3171552ab 100644 --- a/packages/api/src/crm/contact/services/contact.service.ts +++ b/packages/api/src/crm/contact/services/contact.service.ts @@ -89,6 +89,11 @@ export class ContactService { remote_data?: boolean, ): Promise> { try { + const linkedUser = await this.prisma.linked_users.findUnique({ + where: { + id_linked_user: linkedUserId, + }, + }); const job_resp_create = await this.prisma.events.create({ data: { id_event: uuidv4(), @@ -343,6 +348,12 @@ export class ContactService { status: status_resp, }, }); + await this.webhook.handleWebhook( + result_contact.data.contacts, + 'crm.contact.created', + linkedUser.id_project, + job_id, + ); return { ...resp, data: result_contact.data }; } catch (error) { handleServiceError(error, this.logger);