Skip to content

Commit 3277a5d

Browse files
committed
switched normalize phone to resolvereal phone9
1 parent 09a1e44 commit 3277a5d

File tree

2 files changed

+0
-10
lines changed

2 files changed

+0
-10
lines changed

controllers/whatsappController.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,17 +241,12 @@ const logoutSession = async (req, res) => {
241241

242242
const handleWebhook = async (req, res) => {
243243
try {
244-
console.log("[Webhook] Received payload:", JSON.stringify(req.body));
245244
const messages = extractWebhookMessages(req.body || {});
246245
const results = [];
247246

248-
console.log(messages, 'messages extracted from payload');
249-
console.log(`[Webhook] Extracted ${messages.length} message(s) from payload.`);
250247

251248
for (const msg of messages) {
252249
const result = await followUpService.handleReply(msg.from, msg.body);
253-
254-
console.log(result, 'result from handleReply');
255250
results.push({
256251
from: msg.from,
257252
action: result?.action || 'ignored',

services/followUpService.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -583,17 +583,14 @@ class FollowUpService {
583583

584584
async handleReply(phone, messageBody) {
585585
const cleanedPhone = await this._resolveRealPhoneFromJid(phone)
586-
console.log(`Cleaned phone: ${cleanedPhone}`);
587586
const reply = this._normalizeInboundText(messageBody);
588587

589588
const memberByPhone = await MembersModel.findOne({
590589
phone: cleanedPhone,
591590
});
592591

593-
console.log(`Member found by phone: ${memberByPhone?.whatsappOptIn}`);
594592

595593
if (!memberByPhone) {
596-
console.log('No member found for phone');
597594
return null;
598595
}
599596

@@ -616,7 +613,6 @@ class FollowUpService {
616613
return { action: 'opted_out', journey: null };
617614
}
618615

619-
console.log(`Opt-out check done. Proceeding with reply handling.`);
620616

621617
if (this._isOptIn(reply) && memberByPhone) {
622618
memberByPhone.whatsappOptIn = true;
@@ -630,7 +626,6 @@ class FollowUpService {
630626
);
631627
return { action: 'opted_in', journey: null };
632628
}
633-
console.log(`Opt-in check done. Proceeding with help check.`);
634629

635630
if (this._isHelp(reply)) {
636631
await wahaService.sendText(

0 commit comments

Comments
 (0)