Skip to main content

Configure push notification attributes for messages

When sending a message, use NCPushConfig within NCSendMessageParams to customize the push notification behavior for that individual message. For example:

  • Customize push notification content (pushContent)
  • Add extra data to the remote push notification (pushData)
  • Disable push notifications for the message (disableNotification)
Objective C
NCTextMessage *textContent = [[NCTextMessage alloc] initWithText:@"Test text message"];

NCSendMessageParams *params = [[NCSendMessageParams alloc] initWithContent:textContent];

// Customize push notification properties
NCPushConfig *pushConfig = [[NCPushConfig alloc] init];
pushConfig.pushContent = @"Notification content";
pushConfig.pushData = @"Additional pushData for the notification";
params.pushConfig = pushConfig;

// To disable push notifications for this message:
// params.disableNotification = YES;

NCDirectChannel *channel = [[NCDirectChannel alloc] initWithChannelId:@"targetUserId"];
[channel sendMessageWithParams:params attachedHandler:^(NCMessage * _Nullable message) {
// Message saved to local DB
} completionHandler:^(NCMessage * _Nullable sentMessage, NCError * _Nullable error) {
// Handle send result
}];

Message push property reference

NCPushConfig properties (set via NCSendMessageParams.pushConfig)

PropertyTypeDescription
pushTitleNSString *Push notification title. nil uses the default title.
pushContentNSString *Push notification content. When set, overrides the default push content for the message type. nil uses the default.
pushDataNSString *Additional data attached to the remote push notification. Accessible from the push notification payload.
disablePushTitleBOOLWhether to hide the push notification title for this message. When YES, only the body is shown.
forceShowDetailContentBOOLWhether to force showing notification content even when recipient has opted to hide message details. Default NO.
templateIdNSString *Push template ID for localized push content.
iOSConfigNCIOSPushConfig *iOS-specific push configuration (APNs thread ID, collapse ID, etc.).
PropertyTypeDescription
pushConfigNCPushConfig *Per-message push configuration. nil uses the default push strategy.
disableNotificationBOOLWhether to disable remote push and local notifications. Defaults to NO.
needReceiptBOOLWhether a read receipt is required.