Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 143 additions & 0 deletions docs/app_and_channel_settings/app_settings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
Application level settings control

- The primary storage location
- Production & Development modes
- Authentication behaviour
- Push providers
- Action handlers webhooks
- CDN settings

See also the [User Average Response Time](/chat/docs/python/user_average_response_time/) feature for tracking user responsiveness.

The easiest way to edit this is the dashboard. The docs below show how to change it with the API.

### Edge network & Storage Location

Stream runs an edge network of servers around the world. This ensures that when users connect the chat loads quickly.
We also support offline storage & optimistic UI updates in all SDKs, ensuring a fast user experience.

At the app level you can control the primary region. This is where your data is stored.
Connections always happen at the edge, but data is stored in this primary region.

### Production & Development Mode

Stream apps can be configured to be either in `development mode` or in `production mode`. You can select which mode your app should be in when you create it in the Stream dashboard, and you can easily switch between modes later on.

When your app is in production mode, certain destructive features in the dashboard are disabled. This prevents you from accidentally deleting user data or disabling mission-critical features.

### Authentication Behaviour

Application level settings allow you to configure settings that impact all the channel types in your app. Our backend SDKs make it easy to change the app settings. You can also change most of these using the CLI or the dashboard. Here's an example on changing the disable_auth_checks setting:

```python
# disable auth checks, allows dev token usage
client.update_app_settings(disable_auth_checks=True)

# re-enable auth checks
client.update_app_settings(disable_auth_checks=False)
```

These 2 settings are important. Never run with disable_auth_checks or disable_permission_checks in production.

| NAME | DESCRIPTION | DEFAULT |
| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| disable_auth_checks | Disabled authentication. Convenient during testing and allows you to use devTokens on the client side. Should not be used in production. | false |
| disable_permissions_checks | Gives all users full permissions to edit messages, delete them etc. Again not recommended in a production setting, only useful for development. | false |

## Other app settings

### Push

| NAME | DESCRIPTION | DEFAULT |
| --------------- | ----------------------------------------------------------------------------------------- | ------- |
| apn_config | APN config object. See [details](/chat/docs/python#settings-updateapp-request). | |
| firebase_config | Firebase config object. See [details](/chat/docs/python#settings-updateapp-request). | |
| huawei_config | Huawei config object. See [details](/chat/docs/python#settings-updateapp-request). | |
| xiaomi_config | Xiaomi config object. See [details](/chat/docs/python#settings-updateapp-request). | |
| push_config | Global config object. See [details](/chat/docs/python#settings-updateapp-request). | |

### CDN

| NAME | DESCRIPTION | DEFAULT |
| ---------------------- | ------------------------------------------------------------------------------------------ | ----------------- |
| cdn_expiration_seconds | CDN URL expiration time. See [details](/chat/docs/python#settings-updateapp-request). | 1209600 (14 days) |

### Hooks

#### Custom Action Handler and Before Message Send Webhooks

| NAME | DESCRIPTION | DEFAULT |
| ---------------------------- | --------------------------------------------------------------------------------------------------------------- | ------- |
| custom_action_handler_url | This webhook reacts to custom /slash commands and actions on those commands/ | - |
| before_message_send_hook_url | This webhook allows you to modify or moderate message content before sending it to the chat for everyone to see | - |

### Webhooks, SQS, SNS, and pending messages

Webhooks, SQS, SNS, and pending messages async moderation now use the `event_hooks` array configuration. See the [Webhooks](/chat/docs/python/webhooks_overview/) documentation for complete details.

### Moderation & Translation

The following settings allow you to control moderation for your chat:

| NAME | DESCRIPTION | DEFAULT |
| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| image_moderation_labels | Moderation scores returned from the external image moderation API | - |
| image_moderation_enabled | If image moderation AI should be turned on | - |
| enforce_unique_usernames | If Stream should enforce username uniqueness. This prevents people from joining the chat as "elonmusk" while "elonmusk" is presenting. | - |
| auto_translation_enabled | If Stream should automatically translate messages | - |
| async_url_enrich_enabled | If url enrichment should be done async. It will trigger message.updated event | - |

### File Uploads

You can set restrictions on file uploads by including a `file_upload_config` object. You can set either an inclusive list using `allowed_file_extensions` and `allowed_mime_types` or an exclusive list using `blocked_file_extensions` and `blocked_mime_types` .

The `file_upload_config` object accepts the following fields:

| NAME | DESCRIPTION | Example | Default |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- | ------- |
| allowed_file_extensions | An array of file types that the user can submit. Files with an extension that does not match the values in this array will be rejected. | [".tar", ".png", ".jpg"] | - |
| blocked_file_extensions | An array of file types that the user can submit. Files with an extension that does not match the values in this array will be rejected. | [".tar", ".png", ".jpg"] | - |
| allowed_mime_types | An array of file MIME types that the user can submit. Files with an MIME type that does not match the values in this array will be rejected. Must follow the type/ subtype pattern. | ["text/css", "text/plain", "image/png"] | - |
| blocked_mime_types | An array of file types that the user can submit. Files with an MIME type that does not match the values in this array will be rejected. Must follow the type/ subtype pattern. | ["text/css", "text/plain", "image/png"] | - |
| size_limit | A number that represents the maximum accepted file size in bytes. In case its 0 the default maximum is used. | 10485760 | 0 |

For example, the following code shows how to block all attempts to upload any files that are not .csv:

```python
# Only accept .CSV files

client.update_app_settings({
"file_upload_config": {
"allowed_file_extensions": [".csv"],
"allowed_mime_types": ["text/csv"],
}})
```

### Image Uploads

You can set restrictions on file uploads by including an `image_upload_config` object. You can set either an inclusive list using `allowed_file_extensions` and `allowed_mime_types` or an exclusive list using `blocked_file_extensions` and `blocked_mime_types` .

The `image_upload_config` object accepts the following fields:

| NAME | DESCRIPTION | Example | Default |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------- | ------- |
| allowed_file_extensions | An array of file types that the user can submit. Files with an extension that does not match the values in this array will be rejected. | [".gif", ".png", ".jpg"] | - |
| blocked_file_extensions | An array of file types that the user can submit. Files with an extension that does not match the values in this array will be rejected. | [".tar", ".tiff", ".jpg"] | - |
| allowed_mime_types | An array of file MIME types that the user can submit. Files with an MIME type that does not match the values in this array will be rejected. Must follow the type/ subtype pattern. | ["image/jpeg", "image/svg+xml", "image/png"] | - |
| blocked_mime_types | An array of file types that the user can submit. Files with an MIME type that does not match the values in this array will be rejected. Must follow the type/ subtype pattern. | ["text/css", "text/plain", "image/tiff"] | - |
| size_limit | A number that represents the maximum accepted file size in bytes. In case its 0 the default maximum is used. | 10485760 | 0 |

For example, the following code shows how to block all attempts to upload any files that are not gif, jpeg, or png files:

```python
# Only accept gif, jpeg, or png files.

client.update_app_settings({
"image_upload_config": {
"allowed_file_extensions": [".gif", ".jpeg", ".png"],
"allowed_mime_types": ["image/gif", "image/jpeg", "image/png"],
}})
```

> [!NOTE]
> Stream allowed types for images are: `image/bmp` , `image/gif` , `image/jpeg` , `image/png` , `image/webp` , `image/heic` , `image/heic-sequence` , `image/heif` , `image/heif-sequence` , `image/svg+xml` . Applications can set a more restrictive list, but would not be allowed to set a less restrictive list.
66 changes: 66 additions & 0 deletions docs/app_and_channel_settings/channel-level_settings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
In most cases, you define your channel settings and features at the [Channel Type](/chat/docs/python/channel_features/) level and then have these inherited by all the channels of the same type. For instance you can configure [Livestream](/chat/docs/python/channel_features/) channels without typing events and enable reactions and replies for all [Messaging](/chat/docs/python/channel_features/) type channels.

This approach does not work well if your application has many different combination of settings for channels and that is when channel-level settings can be useful.

Channel-level settings allow you to override one or more settings for a channel without changing other channels of the same type. A few important things to mention about channel-level settings:

1. Settings that are not overridden at channel level will use the current setting from the channel type

2. Changing channel-level settings can only be done server-side

### List of settings that can be overridden

Not all channel type settings can be configured at the channel level, here is the complete list of settings that can be overridden.

- **typing_events** : Controls if typing indicators are shown.

- **reactions** : Controls if users are allowed to add reactions to messages.

- **replies** : Enables message threads and replies.

- **uploads** : Allows image and file uploads within messages.

- **url_enrichment** : When enabled, messages containing URLs will be enriched automatically with image and text related to the message.

- **commands** : Enable a set of commands for this channel.

- **max_message_length** : The max message length.

- **blocklist** : A list of words you can define to moderate chat messages. More information can be found [here](/moderation/docs/engines/blocklists-and-regex-filters/).

- **blocklist_behavior** : set as  `block`  or  `flag` to determine what happens to a message containing blocked words.

- **grants** : Allows to modify channel-type permission grants for particular channel. More information can be found [here](/chat/docs/python/chat_permission_policies/)

- **user_message_reminders** : Allow users to set reminders for messages. More information can be found [here](/chat/docs/python/message_reminders/)

- **shared_locations** : Allow users to share their current location. More information can be found [here](/chat/docs/python/location_sharing/)

- **count_messages** : Enables counting messages on new channels.

### Examples

#### Use a different blocklist

```python
channel.update_partial(
{
"config_overrides": {
"blocklist": "medical_blocklist",
"blocklist_behavior": "block",
},
}
)
```

#### Disables replies

```python
channel.update_partial({"config_overrides": {"replies": False}})
```

#### Remove overrides and go back to default settings

```python
channel.update_partial({"config_overrides": {}})
```
Loading
Loading