Skip to content

Conversation

@baermat
Copy link
Member

@baermat baermat commented Dec 17, 2025

Motivation

In AWS, you can opt-out phone numbers so they are not included in sms push notifications. This opt-out is usually done via keyword response (STOP and similar words) to the sms message, or can be done in AWS Console in a Service called Pinpoint.

  • The sms response is very involved to setup, especially since I don't have an US phone number and I am based in Austria.
  • Our current implementation of pinpoint doesn't support the operation we need.
    • Furthermore, it would require a completely new pinpoint <-> sns integration, for a service that is scheduled for deprecation.
      This PR therefore implements a simple endpoint to allow users opting-out phone numbers for the sake testing and using SNS' opted-out operations.

closes PNX-549

Changes

  • adds /_aws/sns/phone-opt-outs as POST endpoint to SNS
  • adds test
  • changes the type of opted out phone numbers to a set.

Tests

Related

@baermat baermat added semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases docs: skip Pull request does not require documentation changes notes: skip Pull request does not have to be mentioned in the release notes and removed docs: skip Pull request does not require documentation changes labels Dec 17, 2025
@github-actions
Copy link

github-actions bot commented Dec 17, 2025

Test Results - Preflight, Unit

22 981 tests  ±0   21 139 ✅ ±0   6m 29s ⏱️ +20s
     1 suites ±0    1 842 💤 ±0 
     1 files   ±0        0 ❌ ±0 

Results for commit a225dbad. ± Comparison against base commit 14d1ccb.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Dec 17, 2025

Test Results (amd64) - Acceptance

7 tests  ±0   5 ✅ ±0   3m 2s ⏱️ ±0s
1 suites ±0   2 💤 ±0 
1 files   ±0   0 ❌ ±0 

Results for commit a225dbad. ± Comparison against base commit 14d1ccb.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Dec 17, 2025

Test Results - Alternative Providers

208 tests   - 1 260   164 ✅  - 723   2m 11s ⏱️ - 30m 58s
  1 suites  -     4    44 💤  - 537 
  1 files    -     4     0 ❌ ±  0 

Results for commit a225dbad. ± Comparison against base commit 14d1ccb.

This pull request removes 1261 and adds 1 tests. Note that renamed tests count towards both.
tests.aws.services.cloudformation.api.test_changesets ‑ test_autoexpand_capability_requirement
tests.aws.services.cloudformation.api.test_changesets ‑ test_create_and_then_remove_non_supported_resource_change_set
tests.aws.services.cloudformation.api.test_changesets ‑ test_create_and_then_remove_supported_resource_change_set
tests.aws.services.cloudformation.api.test_changesets ‑ test_create_and_then_update_refreshes_template_metadata
tests.aws.services.cloudformation.api.test_changesets ‑ test_create_change_set_create_existing
tests.aws.services.cloudformation.api.test_changesets ‑ test_create_change_set_invalid_params
tests.aws.services.cloudformation.api.test_changesets ‑ test_create_change_set_missing_stackname
tests.aws.services.cloudformation.api.test_changesets ‑ test_create_change_set_no_changes
tests.aws.services.cloudformation.api.test_changesets ‑ test_create_change_set_update_nonexisting
tests.aws.services.cloudformation.api.test_changesets ‑ test_create_change_set_update_without_parameters
…
tests.aws.services.sns.test_sns.TestSNSSMS ‑ test_opt_out_phone_number_via_endpoint

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Dec 17, 2025

Test Results (amd64) - Integration, Bootstrap

    5 files  ±    0      5 suites  ±0   1h 29m 43s ⏱️ - 1h 6m 23s
3 146 tests  - 2 408  2 976 ✅  - 2 021  170 💤  - 387  0 ❌ ±0 
3 154 runs   - 2 406  2 978 ✅  - 2 019  176 💤  - 387  0 ❌ ±0 

Results for commit a225dbad. ± Comparison against base commit 14d1ccb.

This pull request removes 2409 and adds 1 tests. Note that renamed tests count towards both.
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_lambda_dynamodb
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_opensearch_crud
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_search_books
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_setup
tests.aws.scenario.kinesis_firehose.test_kinesis_firehose.TestKinesisFirehoseScenario ‑ test_kinesis_firehose_s3
tests.aws.scenario.lambda_destination.test_lambda_destination_scenario.TestLambdaDestinationScenario ‑ test_destination_sns
tests.aws.scenario.lambda_destination.test_lambda_destination_scenario.TestLambdaDestinationScenario ‑ test_infra
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_prefill_dynamodb_table
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input0-SUCCEEDED]
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input1-SUCCEEDED]
…
tests.aws.services.sns.test_sns.TestSNSSMS ‑ test_opt_out_phone_number_via_endpoint
This pull request removes 388 skipped tests and adds 1 skipped test. Note that renamed tests count towards both.
tests.aws.scenario.kinesis_firehose.test_kinesis_firehose.TestKinesisFirehoseScenario ‑ test_kinesis_firehose_s3
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input4-FAILED]
tests.aws.scenario.mythical_mysfits.test_mythical_misfits.TestMythicalMisfitsScenario ‑ test_deployed_infra_state
tests.aws.scenario.mythical_mysfits.test_mythical_misfits.TestMythicalMisfitsScenario ‑ test_populate_data
tests.aws.scenario.mythical_mysfits.test_mythical_misfits.TestMythicalMisfitsScenario ‑ test_user_clicks_are_stored
tests.aws.services.cloudcontrol.test_cloudcontrol_api.TestCloudControlResourceApi ‑ test_api_exceptions
tests.aws.services.cloudcontrol.test_cloudcontrol_api.TestCloudControlResourceApi ‑ test_create_exceptions
tests.aws.services.cloudcontrol.test_cloudcontrol_api.TestCloudControlResourceApi ‑ test_create_invalid_desiredstate
tests.aws.services.cloudcontrol.test_cloudcontrol_api.TestCloudControlResourceApi ‑ test_double_create_with_client_token
tests.aws.services.cloudcontrol.test_cloudcontrol_api.TestCloudControlResourceApi ‑ test_lifecycle
…
tests.aws.services.sns.test_sns.TestSNSSMS ‑ test_opt_out_phone_number_via_endpoint

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Dec 17, 2025

LocalStack Community integration with Pro

    2 files  ±    0      2 suites  ±0   1h 0m 19s ⏱️ - 54m 18s
3 121 tests  - 2 031  2 948 ✅  - 1 808  173 💤  - 223  0 ❌ ±0 
3 126 runs   - 2 028  2 951 ✅  - 1 805  175 💤  - 223  0 ❌ ±0 

Results for commit a225dbad. ± Comparison against base commit 14d1ccb.

This pull request removes 2032 and adds 1 tests. Note that renamed tests count towards both.
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_lambda_dynamodb
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_opensearch_crud
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_search_books
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_setup
tests.aws.scenario.kinesis_firehose.test_kinesis_firehose.TestKinesisFirehoseScenario ‑ test_kinesis_firehose_s3
tests.aws.scenario.lambda_destination.test_lambda_destination_scenario.TestLambdaDestinationScenario ‑ test_destination_sns
tests.aws.scenario.lambda_destination.test_lambda_destination_scenario.TestLambdaDestinationScenario ‑ test_infra
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_prefill_dynamodb_table
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input0-SUCCEEDED]
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input1-SUCCEEDED]
…
tests.aws.services.sns.test_sns.TestSNSSMS ‑ test_opt_out_phone_number_via_endpoint
This pull request removes 224 skipped tests and adds 1 skipped test. Note that renamed tests count towards both.
tests.aws.scenario.kinesis_firehose.test_kinesis_firehose.TestKinesisFirehoseScenario ‑ test_kinesis_firehose_s3
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input4-FAILED]
tests.aws.scenario.mythical_mysfits.test_mythical_misfits.TestMythicalMisfitsScenario ‑ test_deployed_infra_state
tests.aws.scenario.mythical_mysfits.test_mythical_misfits.TestMythicalMisfitsScenario ‑ test_populate_data
tests.aws.scenario.mythical_mysfits.test_mythical_misfits.TestMythicalMisfitsScenario ‑ test_user_clicks_are_stored
tests.aws.services.cloudcontrol.test_cloudcontrol_api.TestCloudControlResourceApi ‑ test_api_exceptions
tests.aws.services.cloudcontrol.test_cloudcontrol_api.TestCloudControlResourceApi ‑ test_create_exceptions
tests.aws.services.cloudcontrol.test_cloudcontrol_api.TestCloudControlResourceApi ‑ test_create_invalid_desiredstate
tests.aws.services.cloudcontrol.test_cloudcontrol_api.TestCloudControlResourceApi ‑ test_double_create_with_client_token
tests.aws.services.cloudcontrol.test_cloudcontrol_api.TestCloudControlResourceApi ‑ test_lifecycle
…
tests.aws.services.sns.test_sns.TestSNSSMS ‑ test_opt_out_phone_number_via_endpoint

♻️ This comment has been updated with latest results.

@baermat baermat added the docs: needed Pull request requires documentation updates label Dec 18, 2025
@baermat baermat marked this pull request as ready for review December 18, 2025 11:15
@baermat baermat requested a review from bentsku as a code owner December 18, 2025 11:15
Copy link
Contributor

@bentsku bentsku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, nice addition! Just a minor comment regarding marking the test as not runnable in a different process, but then we're good to go 🚀

TAGS: TaggingService = CrossRegionAttribute(default=TaggingService)

PHONE_NUMBERS_OPTED_OUT: list[PhoneNumber] = CrossRegionAttribute(default=list)
PHONE_NUMBERS_OPTED_OUT: set[PhoneNumber] = CrossRegionAttribute(default=set)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quick followup question from the previous PR: should we put this back as lower case to follow the rest of the attributes?

response = aws_client.sns.check_if_phone_number_is_opted_out(phoneNumber=phone_number)
assert not response["isOptedOut"]
data = {"phoneNumber": phone_number, "accountId": account_id}
requests.post("http://localhost:4566/_aws/sns/phone-opt-outs", data=json.dumps(data))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: might be worth switch this to phone_url = config.external_service_url() + SMS_PHONE_NUMBER_OPT_OUT_ENDPOINT like the other tests.

Also worth saying that the other endpoint tests are using internal_service_url, so those won't work in the k8s environment, so it might be worth marking this test as @markers.requires_in_process for now until we can validate they would work 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs: needed Pull request requires documentation updates notes: skip Pull request does not have to be mentioned in the release notes semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants