Skip to content

Commit 0137909

Browse files
committed
Remove placeholder emails - enforce clean contact management\n\nCLEAN APPROACH (Option A):\n\n REMOVED: Placeholder email generation (sms.timestamp@placeholder.com)\n ENFORCED: Email-first workflow (email verification SMS/WhatsApp verification)\n PROTECTED: No fake emails in GHL database\n SIMPLIFIED: Widget flow uses contactId, legacy flow requires existing phone contact\n\nSMS/WhatsApp verification now:\n- Widget flow: Uses contactId to update existing email contact with phone\n- Legacy flow: Only works with existing phone contacts or throws descriptive error\n- No placeholder emails, no fake data, no accidental workflow triggers\n\nMuch cleaner and safer approach.
1 parent eeace60 commit 0137909

1 file changed

Lines changed: 4 additions & 24 deletions

File tree

src/tools/contact-tools.ts

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,18 +1315,8 @@ export class ContactTools {
13151315
contactId = foundContact.id;
13161316
console.log('[SMS Verification] Found existing contact by phone:', contactId);
13171317
} else {
1318-
// Create new contact with phone + valid placeholder email
1319-
const newContact = await this.createContact({
1320-
email: `sms.${Date.now()}@placeholder.com`, // Unique placeholder email
1321-
phone: formattedPhone,
1322-
firstName: params.firstName || '',
1323-
lastName: params.lastName || ''
1324-
});
1325-
if (!newContact.id) {
1326-
throw new Error('Contact created but missing ID');
1327-
}
1328-
contactId = newContact.id;
1329-
console.log('[SMS Verification] Created new contact with placeholder email:', contactId);
1318+
// For SMS-only verification without existing contact, require minimal email
1319+
throw new Error('SMS verification requires either existing contactId or contact with email. For phone-only contacts, use start_email_verification first or provide contactId parameter.');
13301320
}
13311321
}
13321322

@@ -1404,18 +1394,8 @@ export class ContactTools {
14041394
contactId = foundContact.id;
14051395
console.log('[WhatsApp Verification] Found existing contact by phone:', contactId);
14061396
} else {
1407-
// Create new contact with phone + valid placeholder email
1408-
const newContact = await this.createContact({
1409-
email: `whatsapp.${Date.now()}@placeholder.com`, // Unique placeholder email
1410-
phone: formattedPhone,
1411-
firstName: params.firstName || '',
1412-
lastName: params.lastName || ''
1413-
});
1414-
if (!newContact.id) {
1415-
throw new Error('Contact created but missing ID');
1416-
}
1417-
contactId = newContact.id;
1418-
console.log('[WhatsApp Verification] Created new contact with placeholder email:', contactId);
1397+
// For WhatsApp-only verification without existing contact, require minimal email
1398+
throw new Error('WhatsApp verification requires either existing contactId or contact with email. For phone-only contacts, use start_email_verification first or provide contactId parameter.');
14191399
}
14201400
}
14211401

0 commit comments

Comments
 (0)