# SNS

Stream can send payloads of all events from your application to an [Amazon SNS](https://aws.amazon.com/sns/) topic you own.

A chat application with a lot of users generates a lots of events. With a standard Webhook configuration, events are posted to your server and can overwhelm unprepared servers during high-use periods. While the server is out, it will not be able to receive Webhooks and will fail to process them. One way to avoid this issue is to use Stream Chat's support for sending webhooks to Amazon SNS.

SNS removes the chance of losing data for Chat events by providing a large, scalable message exchange that delivers events generated by Stream Chat to as many consumers as you like.

The complete list of supported events is identical to those sent through webhooks and can be found on the [Events](/chat/docs/<framework>/webhook_events/) page.

## Configuration

<admonition type="important">

Stream is gradually rolling out a new multi-event hooks system. If you receive an error about webhook configuration, please refer to the [Multi-Event Hooks](/chat/docs/<framework>/multi_event_hooks/) documentation for the new configuration method.

</admonition>

You can configure your SNS topic through the Stream Dashboard or using the Dashboard or programmatically using the REST API or an SDK with Server Side Authorization.

There are 2 ways to configure authentication on your SNS topic:

1. By providing a key and secret

2. Or by having Stream's AWS account assume a role on your SNS topic. With this option you omit the key and secret, but instead you set up a resource-based policy to grant Stream Publish permission on your SNS topic. The following policy needs to be attached to your topic (replace the value of Resource with the fully qualified ARN of your topic):

<codetabs>

<codetabs-item value="json" label="JSON">

```json
{
  "Sid": "AllowStreamProdAccount",
  "Effect": "Allow",
  "Principal": {
    "AWS": "arn:aws:iam::185583345998:root"
  },
  "Action": "SNS:Publish",
  "Resource": "arn:aws:sns:us-west-2:1111111111:customer-sns-topic"
}
```

</codetabs-item>

</codetabs>

### Configuring SNS through the Dashboard

1. Open the [Dashboard](https://dashboard.getstream.io).

2. Select the App you want to configure from the *App dropdown*.

3. Open the *Chat dropdown* and select *Overview*.

4. Scroll down to the *Amazon SNS* section and enter the following information.

- SNS Topic ARN

- AWS Key (optional)

- AWS Secret (optional)

At this point, you can click *Test SNS* to have Stream's servers test their connection with SNS and report back.

### Configure Programmatically

To configure an SNS topic, use a server-side SDK to set the `sns_topic_arn` , `sns_key` & `sns_secret` app settings.

<codetabs>

<codetabs-item value="go" label="Go">

```go
// set your SNS topic details
settings := &AppSettings{
	SnsTopicArn:  "arn:aws:sns:us-east-1:123456789012:sns-topic",
	SnsKey:  "yourkey",
	SnsSecret: "yoursecret",
}

client.UpdateAppSettings(ctx, settings)

//send a test message
req := &CheckSQSRequest{
	SnsTopicArn:  "arn:aws:sns:us-east-1:123456789012:sns-topic",
	SnsKey:  "yourkey",
	SnsSecret: "yoursecret",
}
client.CheckSns(ctx, req)
```

</codetabs-item>

<codetabs-item value="nodejs" label="Node">

```js
// set your SNS topic details
await serverClient.updateAppSettings({
  sns_topic_arn: "arn:aws:sns:us-east-1:123456789012:sns-topic",
  sns_key: "yourkey",
  sns_secret: "yoursecret",
});

//send a test message
await client.testSNSSettings({
  sns_topic_arn: "arn:aws:sns:us-east-1:123456789012:sns-topic",
  sns_key: "yourkey",
  sns_secret: "yoursecret",
});
```

</codetabs-item>

<codetabs-item value="php" label="PHP">

```php
// set your SNS topic details
$client->updateAppSettings([
 "sns_topic_arn" => "arn:aws:sns:us-east-1:123456789012:sns-topic"
 "sns_key" => "yourkey",
 "sns_secret" => "yoursecret"
]);

// send a test message
$client->checkSns([
 "sns_topic_arn" => "arn:aws:sns:us-east-1:123456789012:sns-topic",
 "sns_key" => "yourkey",
 "sns_secret" => "yoursecret"
]);
```

</codetabs-item>

<codetabs-item value="python" label="Python">

```python
# set your SNS topic details
client.update_app_settings(
 sns_topic_arn="arn:aws:sns:us-east-1:123456789012:sns-topic",
 sns_key="yourkey",
 sns_secret="yoursecret"
)

# send a test message
client.check_sns("yourkey", "yoursecret", "arn:aws:sns:us-east-1:123456789012:sns-topic")
```

</codetabs-item>

<codetabs-item value="java" label="Java">

```java
// set your SNS topic details
App.
 .update()
 .snsKey("yourkey")
 .snsSecret("yoursecret")
 .snsTopicArn("arn:aws:sns:us-east-1:123456789012:sns-topic")
 .request();

//send a test message
App.checkSns()
	.snsKey("yourkey")
	.snsSecret("yoursecret")
	.snsTopicArn("arn:aws:sns:us-east-1:123456789012:sns-topic")
	.request();
```

</codetabs-item>

<codetabs-item value="ruby" label="Ruby">

```ruby
# set your SNS topic details
client.update_app_settings(
 sns_topic_arn: 'arn:aws:sns:us-east-1:123456789012:sns-topic',
 sns_key: 'yourkey',
 sns_secret: 'yoursecret'
)

# publish a test message
client.check_sns('yourkey', 'yoursecret', 'arn:aws:sns:us-east-1:123456789012:sns-topic')
```

</codetabs-item>

<codetabs-item value="csharp" label="C#">

```csharp
await appClient.UpdateAppSettingsAsync(new AppSettingsRequest
{
  SnsKey = "yourkey",
  SnsSecret = "yoursecret",
  SnsTopicArn = "arn:aws:sns:us-east-1:123456789012:sns-topic",
});

//publish a test message
await appClient.CheckSnsPushAsync(new AppCheckSnsRequest
{
  SnsKey = "yourkey",
  SnsSecret = "yoursecret",
  SnsTopicArn = "arn:aws:sns:us-east-1:123456789012:sns-topic",
});
```

</codetabs-item>

</codetabs>

### SNS Best practices and Assumptions

- Set the maximum message size set to 256 KB.

Messages bigger than the maximum message size will be dropped.

---

This page was last updated at 2025-08-15T14:15:16.379Z.

For the most recent version of this documentation, visit [https://getstream.io/chat/docs/react-native/sns/](https://getstream.io/chat/docs/react-native/sns/).