Skip to main content

Configure message push properties

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)
swift
import NexconnChatSDK

let textContent = TextMessage(text: "Test text message")
let params = SendMessageParams(content: textContent)

let pushConfig = PushConfig()
pushConfig.pushContent = "Notification content"
pushConfig.pushData = "Additional pushData for the notification"
params.pushConfig = pushConfig

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

guard let channel = DirectChannel(channelId: "targetUserId") else {
return
}

channel.sendMessage(
params: params,
attachedHandler: { message in
// Message saved to local DB
},
completionHandler: { sentMessage, error in
// 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.
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.