Account for lid's in send

This commit is contained in:
Darren Clarke 2025-12-04 10:09:52 +01:00
parent 797ed112c6
commit 6fa8eb180b

View file

@ -343,7 +343,10 @@ export default class WhatsappService extends Service {
attachments?: Array<{ data: string; filename: string; mime_type: string }>,
): Promise<void> {
const connection = this.connections[botID]?.socket;
const recipient = `${phoneNumber.replace(/\D+/g, "")}@s.whatsapp.net`;
const digits = phoneNumber.replace(/\D+/g, "");
// LIDs are 15+ digits, phone numbers with country code are typically 10-14 digits
const suffix = digits.length > 14 ? "@lid" : "@s.whatsapp.net";
const recipient = `${digits}${suffix}`;
// Send text message if provided
if (message) {