SCSChatInterface

@interface SCSChatInterface : NSObject

The SCSChatInterface class is the main UI interface to the chat SDK. This object provides functionality to show a pre-chat form, display the chat session UI, and handle notifications.

To get an instance of this class, use the SCServiceCloud.chatUI property on +[SCServiceCloud sharedInstance].

For core chat behavior unrelated to the UI (such as subscribing to session events), see SCSChat.

See

SCSChat
  • Pass a UNNotification to this method to request that the chat feed maximize if required. The chat feed will only maximize if the notification was scheduled by this chat client.

    Declaration

    Objective-C

    - (void)handleNotification:(nonnull UNNotification *)notification;

    Swift

    func handle(_ notification: UNNotification)

    Parameters

    notification

    The UNNotification that chat will respond to.

  • Determines whether a notification should be displayed in the foreground. Returns true if the chat feed is not currently maximized.

    Declaration

    Objective-C

    - (BOOL)shouldDisplayNotificationInForeground;

    Swift

    func shouldDisplayNotificationInForeground() -> Bool
  • Starts a chat session with the default UI. If you want to build your own custom UI, use -[SCSChat startSessionWithConfiguration:completion:] instead.

    Declaration

    Objective-C

    - (void)showChatWithConfiguration:(nonnull SCSChatConfiguration *)configuration;

    Swift

    func showChat(with configuration: SCSChatConfiguration)

    Parameters

    configuration

    The SCSChatConfiguration object which represents the session configuration.

  • Starts a chat session with the default UI. If you set showPrechat to true, this method displays the pre-chat form with the configured fields before starting a chat session.

    If you wish to configure pre-chat separately, or wish to modify data before starting a chat session see -showPrechatWithFields:completion:.

    Declaration

    Objective-C

    - (void)showChatWithConfiguration:(nonnull SCSChatConfiguration *)configuration
                          showPrechat:(BOOL)prechat;

    Swift

    func showChat(with configuration: SCSChatConfiguration, showPrechat prechat: Bool)

    Parameters

    configuration

    SCSChatConfiguration object that represents the session configuration.

    prechat

    Indicates whether to display pre-chat UI before starting a session. Note: If the SCSChatConfiguration.prechatFields property is nil, this value is ignored.

  • Dismisses the chat interface.

    Declaration

    Objective-C

    - (void)dismissChat;

    Swift

    func dismissChat()
  • Shows the pre-chat UI with the specified pre-chat fields.

    Note

    If the user cancels, the prechatFields contents will be unchanged in the completion block.

    Declaration

    Objective-C

    - (void)showPrechatWithFields:
                (nonnull NSArray<SCSPrechatObject *> *)prechatFields
                            modal:(BOOL)modal
                       completion:(nonnull SCSPrechatCompletion)completion;

    Swift

    func showPrechat(withFields prechatFields: [SCSPrechatObject], modal: Bool, completion: @escaping SCSPrechatCompletion)

    Parameters

    prechatFields

    Array of SCSPrechatObject objects that represents the pre-chat configuration.

    modal

    Indicates whether this view displays as a modal UI (true), or as a non-modal full-screen UI (false).

    completion

    Contains an array of pre-chat fields populated with the user input. Also includes a BOOL determining whether the user submitted the form without canceling.

  • Shows the pre-chat UI with the specified pre-chat fields. This method shows a non-modal, full-screen view. To support a modal view, see -showPrechatWithFields:modal:completion:.

    Note

    If the user cancels, the prechatFields contents will be unchanged in the completion block.

    Declaration

    Objective-C

    - (void)showPrechatWithFields:
                (nonnull NSArray<SCSPrechatObject *> *)prechatFields
                       completion:(nonnull SCSPrechatCompletion)completion;

    Swift

    func showPrechat(withFields prechatFields: [SCSPrechatObject], completion: @escaping SCSPrechatCompletion)

    Parameters

    prechatFields

    Array of SCSPrechatObject objects that represents the pre-chat configuration.

    completion

    Contains an array of pre-chat fields populated with the user input. Also includes a BOOL that indicates whether the user submitted the form without canceling.