Smooch

Objective-C

@interface Smooch : NSObject

Swift

class Smooch : NSObject

@abstract The core class used for interacting with Smooch. Provides methods to initialize, configure, and interact with the library.

  • @abstract Initialize the Smooch SDK with the provided settings.

    @discussion This may only be called once (preferably, in application:didFinishLaunchingWithOptions:).

    Use +settings to retrieve and modify the given settings object.

    See

    SKTSettings

    Declaration

    Objective-C

    + (void)initWithSettings:(nonnull SKTSettings *)settings
           completionHandler:(nullable void (^)(NSError *_Nullable,
                                                NSDictionary *_Nullable))handler;

    Swift

    class func initWith(_ settings: SKTSettings) async throws -> [AnyHashable : Any]

    Parameters

    settings

    The settings to use.

    handler

    An optional block to evaluate the result of the operation

  • @abstract Accessor method for the sdk settings.

    @discussion Use this object to update settings at run time.

    Note: Some settings may only be configured at init time. See the SKTSettings class reference for more information.

    See

    SKTSettings

    Declaration

    Objective-C

    + (nullable SKTSettings *)settings;

    Swift

    class func settings() -> SKTSettings?

    Return Value

    Settings object passed in +initWithSettings:completionHandler:, or nil if +initWithSettings:completionHandler: hasn’t been called yet.

  • @abstract Presents the Smooch conversation screen.

    @discussion Uses the top-most view controller of the UIApplicationDelegate as the presenting view controller.

    +initWithSettings:completionHandler: must have been called prior to calling this method.

    Declaration

    Objective-C

    + (void)show;

    Swift

    class func show()
  • @abstract Loads the conversation specified by the ID, and presents the Smooch conversation screen

    @discussion Uses the top-most view controller of the UIApplicationDelegate as the presenting view controller.

    +initWithSettings:completionHandler: must have been called prior to calling this method.

    Declaration

    Objective-C

    + (void)showConversationWithId:(nonnull NSString *)conversationId;

    Swift

    class func showConversation(withId conversationId: String)

    Parameters

    conversationId

    The ID of the conversation to load

  • @abstract Presents the Smooch conversation screen with prefilled text in the message input.

    @discussion Uses the top-most view controller of the UIApplicationDelegate as the presenting view controller with prefilled text in the message input.

    +initWithSettings:completionHandler: must have been called prior to calling this method.

    Declaration

    Objective-C

    + (void)showWithStartingText:(nullable NSString *)startingText;

    Swift

    class func show(withStartingText startingText: String?)
  • @abstract Loads the conversation specified by the ID, and presents the Smooch conversation screen with prefilled text in the message input.

    @discussion Uses the top-most view controller of the UIApplicationDelegate as the presenting view controller with prefilled text in the message input.

    +initWithSettings:completionHandler: must have been called prior to calling this method.

    Declaration

    Objective-C

    + (void)showConversationWithId:(nonnull NSString *)conversationId
                   andStartingText:(nullable NSString *)startingText;

    Swift

    class func showConversation(withId conversationId: String, andStartingText startingText: String?)

    Parameters

    conversationId

    The ID of the conversation to load

    startingText

    The text to prefill in the message input

  • @abstract Dismisses the Smooch conversation, if shown.

    @discussion Note: If a view controller was created and presented using newConversationViewController, calling this method will have no effect.

    +initWithSettings:completionHandler: must have been called prior to calling this method.

    Declaration

    Objective-C

    + (void)close;

    Swift

    class func close()
  • @abstract Destroys the Smooch SDK

    @discussion Smooch is automatically terminated when the application exits. This method does not need to be called manually

    Declaration

    Objective-C

    + (void)destroy;

    Swift

    class func destroy()
  • @abstract Presents the Smooch conversation screen, using the given view controller as presenting view controller.

    @discussion In most cases, it is better to use +show. If you need more fine-grained control over which view controller is used as presenting view controller, use this method instead.

    +initWithSettings:completionHandler: must have been called prior to calling this method.

    Declaration

    Objective-C

    + (void)showConversationFromViewController:(id)viewController;

    Swift

    class func showConversation(fromViewController viewController: Any!)
  • @abstract Loads the conversation specified by the ID, and presents the Smooch conversation screen, using the given view controller as presenting view controller.

    @discussion In most cases, it is better to use +show. If you need more fine-grained control over which view controller is used as presenting view controller, use this method instead.

    +initWithSettings:completionHandler: must have been called prior to calling this method.

    Declaration

    Objective-C

    + (void)showConversationWithId:(nonnull NSString *)conversationId
                fromViewController:(id)viewController;

    Swift

    class func showConversation(withId conversationId: String, fromViewController viewController: Any!)

    Parameters

    conversationId

    The ID of the conversation to load

    viewController

    The view controller to use as the presenting view controller

  • @abstract Presents the Smooch conversation screen, using the given view controller as presenting view controller with prefilled text in the message input.

    @discussion In most cases, it is better to use +show. If you need more fine-grained control over which view controller is used as presenting view controller, use this method instead.

    +initWithSettings:completionHandler: must have been called prior to calling this method.

    Declaration

    Objective-C

    + (void)showConversationFromViewController:(id)viewController
                              withStartingText:(nullable NSString *)startingText;

    Swift

    class func showConversation(fromViewController viewController: Any!, withStartingText startingText: String?)
  • @abstract Loads the conversation specified by the ID, and presents the Smooch conversation screen, using the given view controller as presenting view controller with prefilled text in the message input.

    @discussion In most cases, it is better to use +show. If you need more fine-grained control over which view controller is used as presenting view controller, use this method instead.

    +initWithSettings:completionHandler: must have been called prior to calling this method.

    Declaration

    Objective-C

    + (void)showConversationWithId:(nonnull NSString *)conversationId
                fromViewController:(id)viewController
                   andStartingText:(nullable NSString *)startingText;

    Swift

    class func showConversation(withId conversationId: String, fromViewController viewController: Any!, andStartingText startingText: String?)

    Parameters

    conversationId

    The ID of the conversation to load

    viewController

    The view controller to use as the presenting view controller

    startingText

    The text to prefill in the message input

  • @abstract Creates and returns a Smooch conversation view controller.

    @discussion You may use this view controller to embed the conversation in a navigation controller, to change the modal presentation style, or display it in any way you choose.

    A view controller created in this way is tied to the current user’s conversation at creation time. If the current user changes (i.e. by calling +login:jwt:completionHandler: or +logoutWithCompletionHandler:), the view controller is invalidated and must be recreated for the new user.

    Note: It is the responsibility of the caller to show, hide, and maintain a reference to this view controller. Calling close will not dismiss a view controller created in this way.

    Declaration

    Objective-C

    + (id)newConversationViewController;

    Swift

    class func newConversationViewController() -> Self!

    Return Value

    A new instance of the Smooch conversation view controller class. Returns nil if +initWithSettings:completionHandler: hasn’t been called

  • @abstract Creates and returns a Smooch conversation view controller, loading the conversation specified by the ID

    @discussion You may use this view controller to embed the conversation in a navigation controller, to change the modal presentation style, or display it in any way you choose.

    Note: It is the responsibility of the caller to show, hide, and maintain a reference to this view controller. Calling close will not dismiss a view controller created in this way.

    Declaration

    Objective-C

    + (void)newConversationViewControllerWithId:(nonnull NSString *)conversationId
                              completionHandler:
                                  (nullable void (^)(NSError *_Nullable,
                                                     int *_Nullable))handler;

    Swift

    class func newConversationViewController(withId conversationId: String) async throws -> UnsafeMutablePointer<Int32>

    Parameters

    conversationId

    The ID of the conversation to load

    handler

    Completion handler which provides a UIViewController with the conversation loaded by the specified ID

  • @abstract Creates and returns a Smooch conversation view controller with prefilled text in the message input.

    @discussion You may use this view controller to embed the conversation in a navigation controller, to change the modal presentation style, or display it in any way you choose. The message input will be prefilled with the given startingText

    A view controller created in this way is tied to the current user’s conversation at creation time. If the current user changes (i.e. by calling +login:jwt:completionHandler: or +logoutWithCompletionHandler:), the view controller is invalidated and must be recreated for the new user.

    Note: It is the responsibility of the caller to show, hide, and maintain a reference to this view controller. Calling close will not dismiss a view controller created in this way.

    Declaration

    Objective-C

    + (id)newConversationViewControllerWithStartingText:
        (nullable NSString *)startingText;

    Swift

    class func newConversationViewController(withStartingText startingText: String?) -> Self!

    Return Value

    A new instance of the Smooch conversation view controller class. Returns nil if +initWithSettings:completionHandler: hasn’t been called

  • @abstract Creates and returns a Smooch conversation view controller with prefilled text in the message input, loading the conversation specified by the ID

    @discussion You may use this view controller to embed the conversation in a navigation controller, to change the modal presentation style, or display it in any way you choose. The message input will be prefilled with the given startingText

    Note: It is the responsibility of the caller to show, hide, and maintain a reference to this view controller. Calling close will not dismiss a view controller created in this way.

    Declaration

    Objective-C

    + (void)newConversationViewControllerWithId:(nonnull NSString *)conversationId
                                   startingText:(nullable NSString *)startingText
                              completionHandler:
                                  (nullable void (^)(NSError *_Nullable,
                                                     int *_Nullable))handler;

    Swift

    class func newConversationViewController(withId conversationId: String, startingText: String?) async throws -> UnsafeMutablePointer<Int32>

    Parameters

    conversationId

    The ID of the conversation to load

    startingText

    The text to prefill in the message input

    handler

    Completion handler which provides a UIViewController with the conversation loaded by the specified ID

  • @abstract Presents the Smooch conversation list screen.

    @discussion Uses the top-most view controller of the UIApplicationDelegate as the presenting view controller.

    +initWithSettings:completionHandler: must have been called prior to calling this method.

    Declaration

    Objective-C

    + (void)showConversationList;

    Swift

    class func showConversationList()
  • @abstract Presents the Smooch conversation list screen without a create conversation button

    @discussion Uses the top-most view controller of the UIApplicationDelegate as the presenting view controller.

    +initWithSettings:completionHandler: must have been called prior to calling this method.

    Declaration

    Objective-C

    + (void)showConversationListWithoutCreateConversationButton;

    Swift

    class func showConversationListWithoutCreateConversationButton()
  • @abstract Dismisses the Smooch conversation list, if shown.

    @discussion Note: If a view controller was created and presented using newConversationViewController, calling this method will have no effect.

    +initWithSettings:completionHandler: must have been called prior to calling this method.

    Declaration

    Objective-C

    + (void)closeConversationList;

    Swift

    class func closeConversationList()
  • @abstract Presents the Smooch conversation list screen, using the given view controller as presenting view controller.

    @discussion In most cases, it is better to use +show. If you need more fine-grained control over which view controller is used as presenting view controller, use this method instead.

    +initWithSettings:completionHandler: must have been called prior to calling this method.

    Declaration

    Objective-C

    + (void)showConversationListFromViewController:(id)viewController;

    Swift

    class func showConversationList(fromViewController viewController: Any!)
  • @abstract Presents the Smooch conversation list screen without a create conversation button, using the given view controller as presenting view controller.

    @discussion In most cases, it is better to use +show. If you need more fine-grained control over which view controller is used as presenting view controller, use this method instead.

    +initWithSettings:completionHandler: must have been called prior to calling this method.

    Declaration

    Objective-C

    + (void)showConversationListFromViewControllerWithoutCreateConversationButton:
        (id)viewController;

    Swift

    class func showConversationList(fromViewControllerWithoutCreateConversationButton viewController: Any!)
  • @abstract Creates and returns a Smooch conversation list view controller.

    @discussion You may use this view controller to embed the conversation in a navigation controller, to change the modal presentation style, or display it in any way you choose.

    A view controller created in this way is tied to the current user’s conversation at creation time. If the current user changes (i.e. by calling +login:jwt:completionHandler: or +logoutWithCompletionHandler:), the view controller is invalidated and must be recreated for the new user.

    Note: It is the responsibility of the caller to show, hide, and maintain a reference to this view controller. Calling close will not dismiss a view controller created in this way.

    Declaration

    Objective-C

    + (id)newConversationListViewController;

    Swift

    class func newConversationListViewController() -> Self!

    Return Value

    A new instance of the Smooch conversation view controller class. Returns nil if +initWithSettings:completionHandler: hasn’t been called

  • @abstract Creates and returns a Smooch conversation list view controller without a create conversation button.

    @discussion You may use this view controller to embed the conversation in a navigation controller, to change the modal presentation style, or display it in any way you choose.

    A view controller created in this way is tied to the current user’s conversation at creation time. If the current user changes (i.e. by calling +login:jwt:completionHandler: or +logoutWithCompletionHandler:), the view controller is invalidated and must be recreated for the new user.

    Note: It is the responsibility of the caller to show, hide, and maintain a reference to this view controller. Calling close will not dismiss a view controller created in this way.

    Declaration

    Objective-C

    + (id)newConversationListViewControllerWithoutCreateConversationButton;

    Swift

    class func newConversationListViewControllerWithoutCreateConversationButton() -> Self!

    Return Value

    A new instance of the Smooch conversation view controller class. Returns nil if +initWithSettings:completionHandler: hasn’t been called

  • @abstract Sets the conversation list delegate

    @discussion The conversation list delegate is used to respond to events relating to the conversation list

    See

    SKTConversationListDelegate

    Declaration

    Objective-C

    + (void)setConversationListDelegate:
        (nullable id<SKTConversationListDelegate>)delegate;

    Swift

    class func setConversationListDelegate(_ delegate: SKTConversationListDelegate?)

    Parameters

    delegate

    Can we an object conforming to SKTConversationListDelegate, or NULL, which would remove any existing delegate

  • @abstract Sets the current user’s first and last name to be used as a display name when sending messages.

    @discussion This is a shortcut for -setFirstName and -setLastName on [SKTUser currentUser]

    See

    SKTUser

    Declaration

    Objective-C

    + (void)setUserFirstName:(nullable NSString *)firstName
                    lastName:(nullable NSString *)lastName;

    Swift

    class func setUserFirstName(_ firstName: String?, lastName: String?)

    Parameters

    firstName

    The first name of the user

    lastName

    The last name of the user

  • @abstract Accessor method for the current conversation.

    See

    SKTConversation

    Declaration

    Objective-C

    + (nullable SKTConversation *)conversation;

    Swift

    class func conversation() -> SKTConversation?

    Return Value

    Current conversation, or nil if +initWithSettings:completionHandler: hasn’t been called yet.

  • @abstract Get a conversationById. This is an asynchronous call and requires a callback to retrieve the result.

    +initWithSettings:completionHandler: must have been called prior to calling this method.

    See

    SKTConversation

    Declaration

    Objective-C

    + (void)conversationById:(nonnull NSString *)conversationId
           completionHandler:(nullable void (^)(NSError *_Nullable,
                                                SKTConversation *_Nullable))handler;

    Swift

    class func conversation(byId conversationId: String) async throws -> SKTConversation

    Parameters

    conversationId

    the conversationId

  • @abstract Logs in a new Smooch user.

    @discussion You can either use this method to transition from logged out state to logged in, or to switch the currently logged in user to a different one.

    User login state is persisted across app launches. You must call +logoutWithCompletionHandler: to reset to anonymous mode.

    +initWithSettings:completionHandler: must have been called prior to calling this method.

    You may not call login while the conversation screen is shown. Doing so will result in a no-op.

    Declaration

    Objective-C

    + (void)login:(nonnull NSString *)externalId
                      jwt:(nonnull NSString *)jwt
        completionHandler:
            (nullable void (^)(NSError *_Nullable, NSDictionary *_Nullable))handler;

    Swift

    class func login(_ externalId: String, jwt: String) async throws -> [AnyHashable : Any]

    Parameters

    externalId

    The distinct id of the user to login. Must not be nil.

    jwt

    jwt used to prove the origin of the login request. Must not be nil.

  • @abstract Logs out the current user.

    @discussion Calling this method while already in anonymous state has no effect.

    You may not call logout while the conversation screen is shown. Doing so will result in a no-op.

    Declaration

    Objective-C

    + (void)logoutWithCompletionHandler:
        (nullable void (^)(NSError *_Nullable,
                           NSDictionary *_Nullable))completionHandler;

    Swift

    class func logout() async throws -> [AnyHashable : Any]
  • @abstract Force-start a conversation for the current user

    @discussion Creates a user and conversation on the server, allowing the business to reach out proactively to the user via the public API.

    Creating a conversation via this method will count as a monthly active user (MAU) whether messages are exchanged or not, which may incur cost based on your plan. It is strongly recommended to only call this method in the case where a message is likely to be sent.

    This method is called automatically when starting a conversation via the -sendMessage: or -sendImage:withProgress:completion: methods, or when a user sends a message via the conversation view controller.

    @deprecated use + createConversationWithName:description:iconUrl:metadata:completionHandler instead

    Declaration

    Objective-C

    + (void)startConversationWithCompletionHandler:
        (nullable void (^)(NSError *_Nullable,
                           NSDictionary *_Nullable))completionHandler;

    Swift

    class func startConversation() async throws -> [AnyHashable : Any]
  • @abstract Create a conversation for the current user, optionally sending a message of type text as part of the conversation creation

    @discussion Creates a user and conversation on the server, allowing the business to reach out proactively to the user via the public API.

    Creating a conversation via this method will count as an active user conversation (AUC) whether messages are exchanged or not, which may incur cost based on your plan. It is strongly recommended to only call this method in the case where a message is likely to be sent.

    This method is called automatically when starting a conversation via the -sendMessage: or -sendImage:withProgress:completion: methods, or when a user sends a message via the conversation view controller.

    Note: Only a single message of type text can be sent as part of conversation creation. Multiple messages, or other types (e.g files, attachments) will cause this method to return an error.

    Declaration

    Objective-C

    + (void)createConversationWithName:(nullable NSString *)displayName
                           description:(nullable NSString *)description
                               iconUrl:(nullable NSString *)iconUrl
                             avatarUrl:(nullable NSString *)avatarUrl
                              metadata:(nullable NSDictionary *)metadata
                               message:(nullable NSArray<SKTMessage *> *)message
                     completionHandler:(nullable void (^)(NSError *_Nullable,
                                                          NSDictionary *_Nullable))
                                           completionHandler;

    Swift

    class func createConversation(withName displayName: String?, description: String?, iconUrl: String?, avatarUrl: String?, metadata: [AnyHashable : Any]?, message: [SKTMessage]?) async throws -> [AnyHashable : Any]

    Parameters

    displayName

    A user-friendly name to label the conversation in the list (max length 100 characters)

    description

    A string describing the purpose of the conversation (max length 100 characters)

    iconUrl

    An iconUrl to display in the conversation list

    avatarUrl

    An avatarUrl that is associated with the current user

    metadata

    A flat JSON Object that can only contain the following value types: string, number, boolean and null

    message

    An array containing a single SKTMessage type, to be sent as part of conversation creation. Only a message of type text can be sent as part of conversation creation. Multiple messages, or other types (e.g files, attachments) will cause this method to return an error.

    completionHandler

    An optional block to evaluate the result of the operation

  • @abstract Updates the specified conversation for the current user.

    +initWithSettings:completionHandler: must have been called prior to calling this method.

    If the displayName, description, iconUrl, and metadata parameters are all nil, this is a no-op.

    See

    SKTConversation

    Declaration

    Objective-C

    + (void)updateConversationById:(nonnull NSString *)conversationId
                          withName:(nullable NSString *)displayName
                       description:(nullable NSString *)description
                           iconUrl:(nullable NSString *)iconUrl
                          metadata:(nullable NSDictionary *)metadata
                 completionHandler:
                     (nullable void (^)(NSError *_Nullable,
                                        NSDictionary *_Nullable))completionHandler;

    Swift

    class func updateConversation(byId conversationId: String, withName displayName: String?, description: String?, iconUrl: String?, metadata: [AnyHashable : Any]?) async throws -> [AnyHashable : Any]

    Parameters

    conversationId

    the conversationId

    displayName

    A user-friendly name to label the conversation (max length 100 characters)

    description

    A string describing the purpose of the conversation (max length 100 characters)

    iconUrl

    An iconUrl to display in the conversation list

    metadata

    A flat JSON Object that can only contain the following value types: string, number, boolean and null

    completionHandler

    An optional block to evaluate the result of the operation

  • @abstract Toggles whether the input bar is displayed on the conversation view.

    @discussion For some use cases, it can be useful to remove the ability for the user to craft their own messages. For example, if your conversation flow relies solely on postback buttons or quick replies, you may not want to allow the user to send anything other than the presented options.

    Passing NO to this method will hide the input bar entirely, including the media button and the text area, thus preventing the user from sending messages themselves.

    This method may be called at any time, even when the conversation view is currently displayed.

    State is persisted across view controller launches.

    Declaration

    Objective-C

    + (void)setConversationInputDisplayed:(BOOL)displayed;

    Swift

    class func setConversationInputDisplayed(_ displayed: Bool)
  • @abstract Set the push notification token for this device.

    @discussion This method is called automatically if SKTSettings.enableAppDelegateSwizzling is set to YES.

    See

    SKTSettings

    Declaration

    Objective-C

    + (void)setPushToken:(nonnull NSData *)token;

    Swift

    class func setPushToken(_ token: Data)
  • @abstract Handle an incoming push notification.

    @discussion Call this method in your -application:didReceiveRemoteNotification: or -application:didReceiveRemoteNotification:fetchCompletionHandler: callback, passing the userInfo dictionary.

    If the push notification did not originate from Smooch, this is a no-op.

    This method is called automatically if SKTSettings.enableAppDelegateSwizzling is set to YES.

    See

    SKTSettings

    Declaration

    Objective-C

    + (void)handlePushNotification:(nonnull NSDictionary *)userInfo;

    Swift

    class func handlePushNotification(_ userInfo: [AnyHashable : Any])
  • @abstract An object conforming to UNUserNotificationCenterDelegate protocol, used to handle notifications on iOS 10 and above.

    @discussion Implements both methods of UNUserNotificationCenterDelegate.

    By default this object will automatically be set as the UNUserNotificationCenter delegate at init time. Smooch will maintain a reference to your app’s existing delegate (if applicable), and automatically forward any calls for notifications that did not originate from Smooch.

    To disable automatic overriding, you must set SKTSettings.enableUserNotificationCenterDelegateOverride to NO before calling +initWithSettings:completionHandler:. If you choose to do so, you must manually forward any relevant calls from your own delegate object. To check the origin of a notification, see the documentation for SKTPushNotificationIdentifier. For example:

    -(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler { if(notification.request.content.userInfo[SKTPushNotificationIdentifier] != nil){ [[Smooch userNotificationCenterDelegate] userNotificationCenter:center willPresentNotification:notification withCompletionHandler:completionHandler]; return; } }

    -(void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler { if(response.notification.request.content.userInfo[SKTPushNotificationIdentifier] != nil){ [[Smooch userNotificationCenterDelegate] userNotificationCenter:center didReceiveNotificationResponse:response withCompletionHandler:completionHandler]; return; } }

    See

    SKTSettings

    Declaration

    Objective-C

    + (nullable id<UNUserNotificationCenterDelegate>)userNotificationCenterDelegate;

    Return Value

    An object conforming to UNUserNotificationCenterDelegate protocol, or nil if +initWithSettings:completionHandler: hasn’t been called yet.

  • @abstract Handle the user input from a reply type notification action.

    @discussion Call this method in your -application:handleActionWithIdentifier:forRemoteNotification:withResponseInfo:completionHandler:, passing the action identifier, userInfo dictionary, responseInfo dictionary, and completionHandler callback.

    This method will post a message on behalf of the user, with the contents of their inline reply. When the message upload completes (either in success or failure), the completion handler will be called.

    If the action identifier does not match SKTUserNotificationReplyActionIdentifier, the completion handler will be called immediately and the notification will be ignored.

    This method is called automatically if SKTSettings.enableAppDelegateSwizzling is set to YES.

    See

    SKTSettings

    Declaration

    Objective-C

    + (void)
        handleUserNotificationActionWithIdentifier:(nonnull NSString *)identifier
                             forRemoteNotification:(nonnull NSDictionary *)userInfo
                                  withResponseInfo:
                                      (nonnull NSDictionary *)responseInfo
                                 completionHandler:
                                     (nonnull void (^)(void))completionHandler;

    Swift

    class func handleUserNotificationAction(withIdentifier identifier: String, forRemoteNotification userInfo: [AnyHashable : Any], withResponseInfo responseInfo: [AnyHashable : Any]) async
  • @abstract Handle the user input from a reply type notification action.

    @discussion Call this method in your -application:handleActionWithIdentifier:forRemoteNotification:withResponseInfo:completionHandler:, passing the action identifier, responseInfo dictionary, and completionHandler callback.

    This method will post a message on behalf of the user, with the contents of their inline reply. When the message upload completes (either in success or failure), the completion handler will be called.

    If the action identifier does not match SKTUserNotificationReplyActionIdentifier, the completion handler will be called immediately and the notification will be ignored.

    This method is called automatically if SKTSettings.enableAppDelegateSwizzling is set to YES.

    See

    SKTSettings @deprecated use +handleActionWithIdentifier:forRemoteNotification:withResponseInfo:completionHandler: instead.

    Declaration

    Objective-C

    + (void)handleUserNotificationActionWithIdentifier:
                (nonnull NSString *)identifier
                                      withResponseInfo:
                                          (nonnull NSDictionary *)responseInfo
                                     completionHandler:
                                         (nonnull void (^)(void))completionHandler;

    Swift

    class func handleUserNotificationAction(withIdentifier identifier: String, withResponseInfo responseInfo: [AnyHashable : Any]) async
  • @abstract A set of categories used for handling and displaying Smooch user notification actions.

    @discussion On iOS 8, returns an empty set. On iOS 9, returns a set of UIUserNotificationCategory objects, to be used with UIUserNotificationSettings +settingsForTypes:categories: On iOS 10, returns a set of UNNotificationCategory objects, to be used with UNUserNotificationCenter -setNotificationCategories:

    Categories are registered automatically if SKTSettings.requestPushPermissionOnFirstMessage is set to YES. If automatic registration is disabled, you must make sure to include the Smooch categories in your calls to the above mentioned methods.

    See

    SKTSettings

    Declaration

    Objective-C

    + (nonnull NSSet *)userNotificationCategories;

    Swift

    class func userNotificationCategories() -> Set<AnyHashable>
  • @abstract Loads a conversation by its ID and sets it as the active conversation for the current session.

    @discussion When called, subscribes the current device for push notifications on the passed conversationId, and sets the SDK to send and receive messages for that conversation going forward. Does not unsubscribe for notification on previously loaded conversations.

    If the conversation is already set to the passed ID, this call is a no-op.

    Declaration

    Objective-C

    + (void)loadConversation:(nonnull NSString *)conversationId
           completionHandler:
               (nullable void (^)(NSError *_Nullable,
                                  NSDictionary *_Nullable))completionHandler;

    Swift

    class func loadConversation(_ conversationId: String) async throws -> [AnyHashable : Any]
  • @abstract Returns a list of conversations from storage.

    @discussion Returns a list of SKTConversation objects from storage.

    Declaration

    Objective-C

    + (void)getConversations:
        (nonnull void (^)(NSError *_Nullable, NSArray *_Nullable))completionHandler;

    Swift

    class func conversations() async throws -> [Any]
  • Deprecated

    Use setConversationDelegate instead.

    @abstract Updating the conversation delegate

    @discussion when called, a new delegate is set

    Declaration

    Objective-C

    + (void)updateConversationDelegate:
        (nonnull id<SKTConversationDelegate>)delegate;

    Swift

    class func update(_ delegate: SKTConversationDelegate)
  • @abstract Set a conversation delegate may be used to receive callbacks when important changes happen in the conversation.

    @discussion In a single conversation scenario, this delegate will be used for the single conversation. In a multi-conversation scenario, this delegate can be used to receive callbacks for changes in all conversations.

    Declaration

    Objective-C

    + (void)setConversationDelegate:(nonnull id<SKTConversationDelegate>)delegate;

    Swift

    class func setConversationDelegate(delegate: SKTConversationDelegate)

    Parameters

    delegate

    A conversation delegate conforming to SKTConversationDelegate.

  • @abstract Loads a list of conversations

    @discussion Retrives the next 10 conversations from the server, and stores them.

    Declaration

    Objective-C

    + (void)getMoreConversations:
        (nonnull void (^)(NSError *_Nullable))completionHandler;

    Swift

    class func moreConversations() async throws
  • @abstract A boolean representing if the server has more conversations to load for the user, to support pagination.

    @discussion When called, returns a boolean indicating if the server has more conversations to load for the user.

    Declaration

    Objective-C

    + (BOOL)hasMoreConversations;

    Swift

    class func hasMoreConversations() -> Bool