Search customer by phone in Admin App

Table of Contents


Business problem

This feature aims to implement the option to search for customers by phone in RBI Admin tool. This was a business request from Iberia (https://rbictg.atlassian.net/browse/IREQ-961), given that customer support doesn’t always have the user’s email when trying to find them.

Architecture AS-IS

Today, Admin Tool only has the option to search customers by email or Cognito ID. The search by email is exemplified by the following sequence diagram.

The most direct solution is using intl-packages, which already exposes a method to search users by phone number and DynamoDB queries for userLookupByPhone records associating phone numbers to Cognito IDs. However, there is a divergence between the records created using intl-packages and the ones created by user-service, as can be seen below:

intl-packages:

{ pk: phoneNumber, pk2: cognitoId, sk: current/user-lookup-by-phone sk2: current/user-lookup-by-phone/{date} }

user-service:

{ pk: phone#${phoneNumber}, pk2: phone_user#${cognitoId}, sk: v0_UserPhone, sk2: v0_UserPhoneUserPhoneLookUp, }

The user-service record is created when a user verifies their phone number via SMS. As far as we can tell, no one is using intl-packages lookup records since its only reference is its own test.

 

Orders made using Call Center won’t appear in the customer history, since they are registered under the Call Center operator account.

Proposed solution n. 1 - DEPRECATED

Add the option in intl-packages to search users by phone number, and change user-service API to create/update lookupByPhoneNumber records whenever there are changes in the customer's phone number. We could take advantage from the development done for SA market in https://rbictg.atlassian.net/browse/IPN-31.

However, this would still require existing customer to update their phone number for the search to work. This problem could be solved if we automatically update the user’s phone number with purchases. This can be done every time or only if they haven’t registered a phone.

 

PROS:

  • The operator of the Admin tool can search by phone.

  • Customers will be associated to a phone number.

  • There is reusage in case OTP Phone validation will be implemented

  • EDGE CASE: In case of incidences on mobile ordering purchases when a user already did previously a delivery purchase, the operator can find the user by phone

CONS:

  • Only one customer can be associated to a phone number. If the user tries to order using an already registered number, an error will appear on the screen.

  • EDGE CASE: There will be a phone number that is not officially validated and it can generate cases where the operator will input a phone number that is not the one expected for the user

  • OPTIONAL: Require a script for legacy data migration to update user phone number in case it is mandatory for the search by phone of older users to work.

Proposed solution n. 2 - APPROVED

Using the Call Center solution to search orders by delivery phone. The search will return a list of orders using the given phone number, and they might come from multiple customer. One solution is to present this list of customers for the support team to decide which one they want to use.

image-20240116-132956.png

This solution has the added bonus that if a phone number is associated to several phone number, that is probably a possible sign of a problem or even fraud.