department-of-veterans-affairs / notification-api

Notification API
MIT License
16 stars 8 forks source link

IIR - Update VAPRO Contact Lookup to Filter by Valid Phone Numbers #2009

Open mjones-oddball opened 5 days ago

mjones-oddball commented 5 days ago

User Story - Business Need

Currently, VA Notify attempts to deliver SMS to any mobile phone number found in VA Profile. Sometimes these SMS fail because the "mobile" phone recorded in VA Profile is actually a landline or other invalid type for texting. Rather than attempting to text a number that will not succeed, we should use the phone validation data provided by VAPRO to determine if it makes sense to proceed to delivery, or fail and alert the client (via callbacks) that the phone number was invalid - thus making the person unreachable by SMS.

See IIR-900

User Story(ies)

As a Business
I want to know if the Veteran is unreachable by SMS due to an invalid phone number So that I can ensure they are receiving the information I'm sending them, and determine if alternate communications are required

As VA Notify
I want to determine if a phone number is valid before proceeding to delivery So that I can efficiently process notifications, and deliver status information back to businesses ASAP if a recipient is unreachable

Additional Info and Resources

Acceptance Criteria

GIVEN VA Profile returns a mobile phone number WHEN the classification is mobile (0), voip (2), prepaid (5) OR a classification is not provided THEN proceed to SMS delivery

GIVEN VA Profile returns a mobile phone number WHEN the classification is landline (1), invalid (3), or other (4) THEN raise a VAProfileNonRetryableException with status: permanent-failure and status_reason: Phone number is invalid

QA Considerations

Potential Dependencies

mjones-oddball commented 5 days ago

Noting that we determined other was not a valid type because of AWS's reply: Occasionally, the response from the phone number validation service includes a PhoneType value of OTHER. The service might return this kind of response in the following situations:

VA Profile said there were currently 32,379 flagged as OTHER as of 9/3.

Other breakdowns below:

image.png
cris-oddball commented 5 days ago

@EvanParish and @AdamKing0126 to sync on this before the branch is deployed, then Evan will sync with me for testing notes.

cris-oddball commented 4 days ago

Evan touched base with me about testing. We discussed:

cris-oddball commented 2 days ago

PR is approved and merged. Sending this to Perf and holding it there until Monday.

cris-oddball commented 2 days ago

On Perf, with Flag disabled, I have verified that Pinpoint is still handling Phone Validation failures by changing a test user's contact Mobile to a prefix 555 number and observing in the logs a Pinpoint event_type=_SMS.FAILURE and observing the test logs for the feature:

V3 Profile -- VA_PROFILE_V3_IDENTIFY_MOBILE_TELEPHONE_NUMBERS is not enabled. Will not check classification info.

Will deploy this up to Prod (staging and prod feature flags are off), then cut a branch to flip Perf on and test that the feature flag works as expected.