Skip to content

Commit

Permalink
✨ Added webhook when contact is created
Browse files Browse the repository at this point in the history
  • Loading branch information
naelob committed Dec 16, 2023
1 parent 7e179a9 commit f3a0000
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/api/src/crm/contact/services/contact.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ export class ContactService {
remote_data?: boolean,
): Promise<ApiResponse<ContactResponse>> {
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(),
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit f3a0000

Please sign in to comment.