Set Up Messaging Push Notifications for iOS

With push notifications, your customers can be alerted about messaging activity even when they aren't viewing the conversation. When an agent sends a message, your customer receives a notification on their device.

This article applies to the following implementations:


Before you add code in your app for notifications, set up Apple Push Notifications as described in the Apple documentation. Then follow Salesforce org setup instructions at Set Push Notifications for Messaging for In-App in Salesforce Help.

When the app successfully registers with the Apple Push Notification service (APNs), pass device token information to the Messaging for In-App server using CoreFactory.provide(deviceToken). See the CoreFactory reference documentation.

By default, when a user taps on the notification, your app launches to the last view that was showing. If you want to take them to the updated conversation, extract the conversationId property, and then use that value to open the correct messaging conversation.

You can get push notifications when the app is open and in the foreground by default. To suppress notifications when the app is open, add the userNotificationCenter function in the AppDelegate.m file and include this code.

See also Apple’s UNNotificationPresentationOptions object reference documentation.

To deregister push notifications, call one of these functions on CoreClient: deregisterDeviceWithCompletion, revokeTokenAndDeregisterDevice, or revokeTokenWithCompletion.

To register a device after you have degregistered a device, pass the device token to the SDK. See the Pass the Token to the SDK section for information.