Substitute org name and balance tokens in outbound SMS so templates no longer leave {از طرف} literal.
EOF Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -511,7 +511,7 @@ export class SmsCampaignsService {
|
||||
const leadIds = batch
|
||||
.map((r) => r.leadId)
|
||||
.filter((id): id is string => Boolean(id));
|
||||
const [people, leads] = await Promise.all([
|
||||
const [people, leads, org] = await Promise.all([
|
||||
personIds.length
|
||||
? this.prisma.person.findMany({
|
||||
where: { id: { in: personIds } },
|
||||
@@ -535,9 +535,14 @@ export class SmsCampaignsService {
|
||||
},
|
||||
})
|
||||
: Promise.resolve([]),
|
||||
this.prisma.organization.findUnique({
|
||||
where: { id: campaign.organizationId },
|
||||
select: { name: true },
|
||||
}),
|
||||
]);
|
||||
const personMap = new Map(people.map((p) => [p.id, p]));
|
||||
const leadMap = new Map(leads.map((l) => [l.id, l]));
|
||||
const fromOrg = org?.name?.trim() || '';
|
||||
|
||||
let sent = 0;
|
||||
let failed = 0;
|
||||
@@ -572,6 +577,7 @@ export class SmsCampaignsService {
|
||||
phone: recipient.mobile,
|
||||
title,
|
||||
company,
|
||||
from: fromOrg,
|
||||
});
|
||||
|
||||
const personalized = await this.tracking.personalizeSmsBody({
|
||||
|
||||
Reference in New Issue
Block a user