Skip to content

Commit e4bbe85

Browse files
document phone opt outs in sns
1 parent 79c7bd0 commit e4bbe85

File tree

1 file changed

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

1 file changed

+43
-0
lines changed

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

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,49 @@ 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+
190+
### Phone opt-outs
191+
192+
For testing purposes, LocalStack provides an internal developer endpoint to add phone numbers to the SNS opt-out list.
193+
194+
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.
195+
196+
This is a **LocalStack internal endpoint**, not part of the AWS SNS public API.
197+
198+
```
199+
POST /_aws/sns/phone-opt-outs
200+
```
201+
202+
#### Query parameters
203+
204+
| Parameter | Required | Description |
205+
| ----------- | -------- | ------------------------------------------------------------------------------------ |
206+
| phoneNumber | Yes | Phone number to add to the SNS opt-out list. |
207+
| accountId | No | AWS Account ID under which the opt-out should be stored. Defaults to `000000000000`. |
208+
209+
The opt-out list is account-wide and stored under the default region `us-east-1`.
210+
211+
#### Create phone opt-out list
212+
213+
Add a phone number to create the opt-out list:
214+
215+
```bash
216+
curl -X POST "http://localhost:4566/_aws/sns/phone-opt-outs" \
217+
-H "Content-Type: application/json" \
218+
-d '{
219+
"phoneNumber": "+123123123",
220+
"accountId": "000000000000"
221+
}'
222+
```
223+
224+
:::note
225+
* This endpoint is intended for **local testing only**.
226+
* The opt-out list is stored per account.
227+
* Adding the same phone number multiple times is safe. Internally, phone numbers are stored in a set, so duplicate entries are ignored.
228+
* Once opted out, SNS operations that respect the opt-out list (for example, `ListPhoneNumbersOptedOut`) will include the number.
229+
:::
230+
231+
189232
### Platform Endpoint messages
190233

191234
For testing purposes, LocalStack retains all messages published to a platform endpoint in memory, making it easy to retrieve them.

0 commit comments

Comments
 (0)