Account for lid's in send
This commit is contained in:
parent
797ed112c6
commit
6fa8eb180b
1 changed files with 4 additions and 1 deletions
|
|
@ -343,7 +343,10 @@ export default class WhatsappService extends Service {
|
||||||
attachments?: Array<{ data: string; filename: string; mime_type: string }>,
|
attachments?: Array<{ data: string; filename: string; mime_type: string }>,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const connection = this.connections[botID]?.socket;
|
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
|
// Send text message if provided
|
||||||
if (message) {
|
if (message) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue