Notifications for Chat Activity

If there’s chat activity when the user is not viewing the chat session, you can present that information to them using the iOS notification system.

The legacy chat product is scheduled for retirement on February 14, 2026, and is in maintenance mode until then. During this phase, you can continue to use chat, but we no longer recommend that you implement new chat channels. To avoid service interruptions to your customers, migrate to Messaging for In-App and Web before that date. Messaging offers many of the chat features that you love plus asynchronous conversations that can be picked back up at any time. Learn about chat retirement in Help.

Notifications can be sent to the user when the user isn’t viewing the chat session. A notification can appear when the app is in the background, or when the app is in the foreground but the chat session is minimized. The following activities can cause notifications:

  • Agent has connected
  • Agent sent a message
  • Agent requested a file transfer
  • Agent canceled a file transfer
  • Agent ended a session
  • Session will timeout soon

To ensure that the app can send these notifications while in the background, chat must be configured to allow background execution (allowBackgroundExecution) and to allow for background notifications (allowBackgroundNotifications). Both these settings are turned on by default. See Configure a Chat Session for details.

  1. Import the UserNotifications framework in your AppDelegate class.

    In Swift:

    In Objective-C:

  2. Register for local notifications in your AppDelegate’s didFinishLaunchingWithOptions method.

    In Swift:

    In Objective-C:

  3. Implement UNUserNotificationCenterDelegate. Handle the didReceiveNotificationResponse and willPresentNotification methods.

    iOS calls the didReceiveNotificationResponse method when your app is in the background. In this method, you can tell your app to enter the foreground and for chat to maximize. To perform this behavior, use the handle(notification:) method on the SCSChatInterface object, which is accessible from the chatUI property of the ServiceCloud shared instance.

    iOS calls the willPresentNotification method when your app is in the foreground. To determine whether to display the notification, use the shouldDisplayNotificationInForeground method (accessible from the chatUI property of the ServiceCloud shared instance). If the Chat UI is already showing the relevant information related to this event, the method returns false.

    In Swift:

    In Objective-C: