Add public API keys, outbound webhooks, and bulk SMS campaigns with settings UI and org modules.
This commit is contained in:
@@ -27,6 +27,7 @@ import {
|
||||
import { LoyaltyService } from '../loyalty/loyalty.service';
|
||||
import { AutomationsService } from '../automations/automations.service';
|
||||
import { MessageAutomationsService } from '../message-automations/message-automations.service';
|
||||
import { WebhooksService } from '../public-api/webhooks.service';
|
||||
import { normalizeTags } from '../common/tags';
|
||||
|
||||
const personInclude = {
|
||||
@@ -72,6 +73,7 @@ export class PeopleService {
|
||||
private readonly loyalty: LoyaltyService,
|
||||
private readonly automations: AutomationsService,
|
||||
private readonly messageAutomations: MessageAutomationsService,
|
||||
private readonly webhooks: WebhooksService,
|
||||
) {}
|
||||
|
||||
async list(
|
||||
@@ -171,6 +173,13 @@ export class PeopleService {
|
||||
};
|
||||
await this.automations.runTrigger('person_created', createdCtx);
|
||||
await this.messageAutomations.onEvent('person_created', createdCtx);
|
||||
this.webhooks.emit(actor.organizationId, 'person.created', {
|
||||
id: row.id,
|
||||
fullName: createdCtx.title,
|
||||
mobile: row.mobile,
|
||||
email: row.email,
|
||||
companyId: row.companyId,
|
||||
});
|
||||
const fresh = await this.prisma.person.findFirst({
|
||||
where: { id: row.id },
|
||||
include: personInclude,
|
||||
@@ -221,6 +230,13 @@ export class PeopleService {
|
||||
data,
|
||||
include: personInclude,
|
||||
});
|
||||
this.webhooks.emit(actor.organizationId, 'person.updated', {
|
||||
id: row.id,
|
||||
fullName: `${row.firstName} ${row.lastName}`.trim(),
|
||||
mobile: row.mobile,
|
||||
email: row.email,
|
||||
companyId: row.companyId,
|
||||
});
|
||||
return this.toDto(row);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user