@@ -590,7 +590,7 @@ class FollowUpService {
590590 } ) ;
591591
592592 if ( ! memberByPhone ) {
593- const cleanedPhone = await this . _resolveRealPhoneFromJid ( phone )
593+ let cleanedPhone = await this . _resolveRealPhoneFromJid ( phone )
594594 memberByPhone = await MembersModel . findOne ( {
595595 phone : cleanedPhone ,
596596 } ) ;
@@ -599,7 +599,7 @@ class FollowUpService {
599599 await memberByPhone . save ( ) ;
600600 }
601601
602- console . log ( 'Resolved member for phone:' , cleanedPhone , 'is:' , memberByPhone ?. firstName ) ;
602+ console . log ( 'Resolved member for phone:' , 'is:' , memberByPhone . phone , memberByPhone ?. firstName ) ;
603603
604604 if ( ! memberByPhone ) {
605605 return null ;
@@ -617,7 +617,7 @@ class FollowUpService {
617617 ) ;
618618
619619 await wahaService . sendText (
620- cleanedPhone ,
620+ memberByPhone . phone ,
621621 'You have been unsubscribed from WhatsApp follow-up messages. Reply START to opt in again.'
622622 ) ;
623623
@@ -632,15 +632,15 @@ class FollowUpService {
632632 await memberByPhone . save ( ) ;
633633
634634 await wahaService . sendText (
635- cleanedPhone ,
635+ memberByPhone . phone ,
636636 'You are now subscribed again. Thank you.'
637637 ) ;
638638 return { action : 'opted_in' , journey : null } ;
639639 }
640640
641641 if ( this . _isHelp ( reply ) ) {
642642 await wahaService . sendText (
643- cleanedPhone ,
643+ memberByPhone . phone ,
644644 'Reply 1, 2, or 3 to choose an option. Reply STOP to opt out, START to opt in.'
645645 ) ;
646646 return { action : 'help' , journey : null } ;
@@ -671,7 +671,7 @@ class FollowUpService {
671671 if ( lastOutbound . messageType === 'absent_reminder' ) {
672672 const result = await this . _handleAbsentReminderReply (
673673 memberByPhone ,
674- cleanedPhone ,
674+ memberByPhone . phone ,
675675 reply
676676 ) ;
677677
@@ -719,7 +719,7 @@ class FollowUpService {
719719
720720 await WhatsappActivity . create ( {
721721 memberId : member ?. _id ,
722- phone : cleanedPhone ,
722+ phone : memberByPhone . phone ,
723723 direction : 'inbound' ,
724724 messageType : 'reply' ,
725725 content : reply ,
@@ -739,18 +739,18 @@ class FollowUpService {
739739 option : configuredOption ,
740740 journey,
741741 member,
742- phone : cleanedPhone ,
742+ phone : memberByPhone . phone ,
743743 } ) ;
744744 } else {
745745 const option = this . _detectOption ( reply , journey . currentStage ) ;
746- if ( option === 1 ) action = await this . _handleOption1 ( journey , firstName , cleanedPhone ) ;
747- else if ( option === 2 ) action = await this . _handleOption2 ( journey , firstName , cleanedPhone ) ;
748- else if ( option === 3 ) action = await this . _handleOption3 ( journey , firstName , cleanedPhone ) ;
746+ if ( option === 1 ) action = await this . _handleOption1 ( journey , firstName , memberByPhone . phone ) ;
747+ else if ( option === 2 ) action = await this . _handleOption2 ( journey , firstName , memberByPhone . phone ) ;
748+ else if ( option === 3 ) action = await this . _handleOption3 ( journey , firstName , memberByPhone . phone ) ;
749749 else if (
750750 journey . currentStage === 2 ||
751751 member ?. whatsappConversationStage === 'prayer_requested'
752752 ) {
753- await this . _handlePrayerRequest ( member , cleanedPhone , reply ) ;
753+ await this . _handlePrayerRequest ( member , memberByPhone . phone , reply ) ;
754754 action = 'prayer_submitted' ;
755755 } else {
756756 action = 'free_text' ;
0 commit comments