Skip to content

Commit ef9137d

Browse files
docs: add endpoint for opting out phone numbers in SNS v2 (#434)
Co-authored-by: Bernhard Matyas <90144234+baermat@users.noreply.github.com>
1 parent be35cdb commit ef9137d

File tree

1 file changed

+45
-0
lines changed
  • src/content/docs/aws/services

1 file changed

+45
-0
lines changed

src/content/docs/aws/services/sns.mdx

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,37 @@ awslocal sns unsubscribe \
186186
LocalStack’s SNS implementation offers additional endpoints for developers located at `/_aws/sns`.
187187
These endpoints provide the ability to access different SNS internals, like Platform Endpoint messages which are not sent to those platforms, or Subscription Tokens which you might not be able to retrieve otherwise.
188188

189+
#### Query parameters
190+
191+
| Parameter | Required | Description |
192+
| ----------- | -------- | ------------------------------------------------------------------------------------ |
193+
| phoneNumber | Yes | Phone number to add to the SNS opt-out list. |
194+
| accountId | No | AWS Account ID under which the opt-out should be stored. Defaults to `000000000000`. |
195+
196+
The opt-out list is account-wide and stored under the default region `us-east-1`.
197+
198+
199+
#### Create phone opt-out list
200+
201+
Add a phone number to create the opt-out list:
202+
203+
```bash
204+
curl -X POST "http://localhost:4566/_aws/sns/phone-opt-outs" \
205+
-H "Content-Type: application/json" \
206+
-d '{
207+
"phoneNumber": "+123123123",
208+
"accountId": "000000000000"
209+
}'
210+
```
211+
212+
:::note
213+
* This endpoint is intended for **local testing only**.
214+
* The opt-out list is stored per account.
215+
* Adding the same phone number multiple times is idempotent (performing the same operation once has the same effect as performing it multiple times).
216+
* Once opted out, SNS operations that respect the opt-out list (for example, `ListPhoneNumbersOptedOut`) will include the number.
217+
:::
218+
219+
189220
### Platform Endpoint messages
190221

191222
For testing purposes, LocalStack retains all messages published to a platform endpoint in memory, making it easy to retrieve them.
@@ -528,6 +559,20 @@ awslocal sns get-subscription-attributes \
528559

529560
SNS will now publish messages to your HTTP endpoint, even if it did not confirm itself the subscription.
530561

562+
563+
### Phone opt-outs
564+
565+
For testing purposes, LocalStack provides an internal developer endpoint to add phone numbers to the SNS opt-out list.
566+
567+
In AWS, phone number opt-outs are typically handled via inbound SMS keywords (for example, `STOP`) or managed through Amazon Pinpoint. Since inbound SMS handling and Pinpoint integration are outside the scope of LocalStack’s SNS emulation, this endpoint allows you to opt-out phone numbers directly for local testing.
568+
569+
This is a LocalStack internal endpoint, not part of the AWS SNS public API.
570+
571+
```
572+
POST /_aws/sns/phone-opt-outs
573+
```
574+
575+
531576
## Resource Browser
532577

533578
The LocalStack Web Application provides a Resource Browser for managing SNS topics.

0 commit comments

Comments
 (0)