Configure Push Notification Attributes for Messages
When sending a message, you can personalize the push behavior of a single message by setting the pushOptions
object.
Example Code
// iOS Push Configuration
let iOSPushOptions: RCIMIWIOSPushOptions = {};
iOSPushOptions.threadId = 'iOS Notification Group ID';
iOSPushOptions.category = 'iOS Rich Push Type Defined by Developer';
iOSPushOptions.apnsCollapseId = 'iOS Notification Collapse ID';
iOSPushOptions.richMediaUri = 'iOS Rich Push Content URL';
// Android Push Configuration
let androidPushOptions: RCIMIWAndroidPushOptions = {};
androidPushOptions.notificationId = 'Android Push Unique Identifier';
androidPushOptions.channelIdMi = 'Xiaomi Channel ID';
androidPushOptions.channelIdHW = 'Huawei Channel ID';
androidPushOptions.channelIdOPPO = 'OPPO Channel ID';
androidPushOptions.pushTypeVIVO = RCIMIWVIVOPushType.SYSTEM; // OPERATE: Operational Message
androidPushOptions.collapseKeyFCM = 'FCM Notification Group ID';
androidPushOptions.imageUrlFCM = 'Huawei Push Message Level';
androidPushOptions.importanceHW = 'Huawei Notification Large Icon URL';
androidPushOptions.imageUrlHW = 'Huawei Notification Large Icon URL';
androidPushOptions.imageUrlMi = 'Xiaomi Large Icon URL';
androidPushOptions.channelIdFCM = 'FCM Notification Channel ID';
// Message Push Configuration
let pushOptions: RCIMIWMessagePushOptions = {};
pushOptions.disableNotification = true;
pushOptions.disablePushTitle = true;
pushOptions.pushTitle = 'Push Title';
pushOptions.pushContent = 'Push Content';
pushOptions.pushData = 'Remote Push Additional Information';
pushOptions.forceShowDetailContent = true;
pushOptions.templateId = 'Push Template ID';
pushOptions.voIPPush = false;
pushOptions.iOSPushOptions = iOSPushOptions;
pushOptions.androidPushOptions = androidPushOptions;
// Create Text Message Object
let message = {
conversationType: RCIMIWConversationType.PRIVATE,
messageType: RCIMIWMessageType.TEXT,
targetId: 'xxx',
pushOptions: pushOptions
}
// Send Message
engine.sendMessage(message);
pushOptions Attribute Description
Attribute Name | Type | Description |
---|---|---|
disableNotification | boolean | Whether to send a notification |
disablePushTitle | boolean | Whether to hide the notification title in the notification bar true: Hide the notification title, false: Show the notification title By default, RC displays the sender's name for one-to-one chat notifications and the group name for group chat notifications. Setting this property will no longer display the notification title. This property is only valid for iOS platform users. Android third-party push platforms require a notification title, so this is not supported. |
pushTitle | string | Push title Default title display rules: Built-in messages: One-to-one chat notifications display the sender's name, group chat notifications display the group name. Custom messages: No title is displayed by default. |
pushContent | string | Push content. |
pushData | string | Remote push additional information. |
forceShowDetailContent | boolean | Whether to force the display of notification details. When the target user has set push notifications to not display message details, this feature can be used to force the display of push details for this message. |
templateId | string | Push template ID After setting, the push content will match the language environment set by the target user via setPushLanguageCode. If no match is found, the default content will be used for push. Template content is set in the "Developer Console - Custom Push Content". Note: The Title and PushContent in RCMessagePushConfig take precedence over the corresponding title and push content in the template ID (templateId) |
voIPPush | boolean | If the target device is iOS, setting isVoIPPush to True will push via the VoIP channel. |
iOSPushOptions | RCIMIWIOSPushOptions | iOS platform-related configuration |
androidPushOptions | RCIMIWAndroidPushOptions | Android platform-related configuration |
iOSPushOptions
Attribute Description
Attribute Name | Type | Description |
---|---|---|
threadId | string | iOS notification group ID. Notifications with the same thread-id are grouped together. Supported from iOS10. |
category | string | iOS rich push type defined by the developer, to be parsed and judged by the App. Used together with richMediaUri. When category is set, the push will carry mutable-content by default, with a property value of 1. If not set, the backend will default to the message type string, such as RC:TxtMsg |
apnsCollapseId | string | iOS notification collapse ID. When apnsCollapseId is the same, new notifications will overwrite old ones. Maximum 64 bytes. Supported from iOS10. |
richMediaUri | string | iOS rich push content URL, used together with category. |
androidPushOptions
Attribute Description
Attribute Name | Type | Description |
---|---|---|
notificationId | string | Android push unique identifier. Currently supported for Xiaomi and Huawei push platforms. By default, developers do not need to set this. When a message generates a push, the message's messageUId is used as the notificationId. |
channelIdMi | string | Xiaomi channel ID The push channel used for Xiaomi for this message. |
channelIdHW | string | Huawei channel ID The push channel used for Huawei for this message. If the developer has integrated Huawei push and needs to specify a channelId, they can obtain it from the Android development team. The channelId is created by the developer. |
categoryHW | string | |
channelIdOPPO | string | OPPO channel ID. The push channel used for OPPO for this message. If the developer has integrated OPPO push and needs to specify a channelId, they can obtain it from the Android development team. The channelId is created by the developer. |
pushTypeVIVO | RCIMIWVIVOPushType | VIVO push channel type. If the developer has integrated VIVO push and needs to specify the push type, this can be set. |
collapseKeyFCM | string | FCM notification group ID |
imageUrlFCM | string | FCM notification image URL |
importanceHW | RCIMIWImportanceHW | Huawei push message level |
imageUrlHW | string | Huawei notification large icon URL. If not set, the notification bar will not display the right icon. The URL must use HTTPS protocol, e.g., https://example.com/image.png. The icon file must be smaller than 512KB, recommended size: 40dp x 40dp, with rounded corners of 8dp. Icons larger than the recommended size may be compressed or not fully displayed. |
channelIdFCM | string | FCM notification channel ID. The application must create a channel using this channel ID before it can receive any notifications with this channel ID. If this channel ID is not sent in the request, or if the app has not created the provided channel ID, FCM will use the channel ID specified in the app manifest. |
categoryVivo | string | |
importanceHonor | RCIMIWImportanceHonor | Honor push message level |
imageUrlHonor | string | Honor notification large icon URL. If not set, the notification bar will not display the right icon. The URL must use HTTPS protocol, e.g., https://example.com/image.png. The icon file must be smaller than 512KB, recommended size: 40dp x 40dp, with rounded corners of 8dp. Icons larger than the recommended size may be compressed or not fully displayed. |
Channel ID needs to be created by the developer. The creation methods are as follows:
Push Channel | Configuration Description |
---|---|
Huawei | On the App side, call the Android SDK to create the Channel ID. |
Xiaomi | Create the Channel ID on the Xiaomi Open Platform management console or via the Xiaomi server API. |
OPPO | On the App side, call the Android SDK to create the Channel ID; register the Channel ID on the OPPO management console to maintain consistency. |
vivo | Call the server API to create the Channel ID. |
External Links
You can learn more about Channel ID through the following links:
- Xiaomi Push: Xiaomi Push Message Classification Rules
- Huawei Push: Custom Notification Channels
- OPPO Push: Push Private Channel Application
- vivo Push: Message Classification Function Description