/ SDKs / JavaScript
SDKs
Chat SDKs JavaScript v4
Chat SDKs JavaScript
Chat SDKs
JavaScript
Version 4

Send a critical alert message to iOS device users

Copy link

Your app is most likely to have users from different devices that runs on iOS, Android, or web, which demands implementation of platform-specific codes when it comes to sending a notification such as a critical alert. A critical alert is a notification that can be sent to iOS device users even when mute or Do Not Disturb is turned on. Use a UserMessageCreateParams instance to properly notify critical alert messages to iOS device users in your app.

First, create an AppleCriticalAlertOptions instance and set it as an attribute of a UserMessageCreateParams instance. Then, pass the UserMessageCreateParams instance as an argument to a parameter in the sendUserMessage() method. The same applies to FileMessageCreateParams and sendFileMessage().

Note: To learn more about how to set critical alerts, visit Apple critical alerts.

User message

Copy link
JavaScriptTypeScript
// Send a critical alert user message.
const params = {
    appleCriticalAlertOptions: new AppleCriticalAlertOptions({ name: 'storm-alert', volume: '0.7' }),   // Acceptable values for volume are 0 to 1.0, inclusive.
};

File message

Copy link
JavaScriptTypeScript
// Send a critical alert file message.
const params = {
    appleCriticalAlertOptions: new AppleCriticalAlertOptions({ name: 'storm-alert', volume: '0.7' }),   // Acceptable values for volume are 0 to 1.0, inclusive.
};