SMICoreClient

Objective-C

@protocol SMICoreClient

Swift

protocol CoreClient

Main entry point for the In-App Messaging core API. To create an instance of this class, use the SMICoreFactory class and provide an SMICoreConfiguration object.

  • Configuration used to determine where to send and receive events for the In-App Messaging service.

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) SMICoreConfiguration *_Nonnull configuration;

    Swift

    @NSCopying var configuration: SMICoreConfiguration { get }
  • Current network connectivity state.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) SMINetworkConnectivityState _Nonnull state;

    Swift

    var state: NetworkConnectivityState { get }
  • Current realtime connection state.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) SMIRealtimeConnectionState _Nonnull realtimeConnectionState;

    Swift

    var realtimeConnectionState: RealtimeConnectionState { get }
  • The delegate that provides hidden pre-chat field values.

    Declaration

    Objective-C

    @property (nonatomic, weak) id<SMIHiddenPreChatDelegate> _Nullable preChatDelegate;

    Swift

    weak var preChatDelegate: (any HiddenPreChatDelegate)? { get set }
  • The delegate that provides the auto-response messaging component parameter values.

    Declaration

    Objective-C

    @property (nonatomic, weak) id<SMITemplatedUrlDelegate> _Nullable templatedUrlDelegate;

    Swift

    weak var templatedUrlDelegate: (any TemplatedUrlDelegate)? { get set }
  • The delegate that provides the challenge for the identity token for user verified connections.

    Declaration

    Objective-C

    @property (nonatomic, weak) id<SMIUserVerificationDelegate> _Nullable userVerificationDelegate;

    Swift

    weak var userVerificationDelegate: (any UserVerificationDelegate)? { get set }
  • Generates an instance of a SMIConversationClient object which is used to manage all conversation data.

    Declaration

    Objective-C

    - (nonnull id<SMIConversationClient>)conversationClientWithId:
        (nullable NSUUID *)conversationId;

    Swift

    func conversationClient(with conversationId: UUID?) -> any SMIConversationClient

    Parameters

    conversationId

    The conversation ID associated with this SMIConversationClient instance. If nil, a UUID is used.

  • Initiates the connection to listen to realtime remote events. Once executed the SMICoreClient will aggressively attempt to maintain this connection at all times.

    See

    -realtimeConnectionState

    Declaration

    Objective-C

    - (void)start;

    Swift

    func start()
  • Terminates the connection listening for realtime remote events.

    See

    -realtimeConnectionState

    Declaration

    Objective-C

    - (void)stop;

    Swift

    func stop()
  • Retrieves the current remote configuration if available. Defaults to offline backups if the current configuration cannot be retrieved.

    Declaration

    Objective-C

    - (void)retrieveRemoteConfigurationWithCompletion:
        (nonnull SMIRemoteConfigurationCompletion)completion;

    Swift

    func retrieveRemoteConfiguration() async throws -> any RemoteConfiguration

    Parameters

    completion

    Contains a reference to an SMIRemoteConfiguration object if successful, or an NSError describing the failure.

  • Retrieves the business hour info for the current deployment.

    Declaration

    Objective-C

    - (void)retrieveBusinessHoursWithCompletion:
        (nonnull SMIBusinessHoursInfoCompletion)completion;

    Swift

    func retrieveBusinessHours() async throws -> any BusinessHoursInfo

    Parameters

    completion

    Contains a reference to an SMIBusinessHoursInfoCompletion object if successful, or an NSError describing the failure.

  • Retrieves conversations available to the local participant.

    Declaration

    Objective-C

    - (void)
        conversationsWithLimit:(NSUInteger)limit
         olderThanConversation:(nullable id<SMIConversation>)olderThanConversation
                    completion:(nonnull SMIConversationQueryCompletion)completion;

    Swift

    func conversations(withLimit limit: UInt, olderThanConversation: (any Conversation)?) async throws -> [any Conversation]

    Parameters

    limit

    The maximum number of results to expect.

    olderThanConversation

    The comparison conversation which serves as a base for returning older conversations. If nil, the query starts from the newest known conversation.

    completion

    The completion that contains the result of the search query.

  • Retrieves n number of conversations from offline cached data sorted by latest activity. This only returns an order based on offline cached data, and may not reflect the real-time state of conversations if the client has not retrieved that activity.

    Declaration

    Objective-C

    - (void)conversationsWithLimit:(NSUInteger)limit
         sortedByActivityDirection:(nullable SMIListAPIDirections)direction
                        completion:
                            (nonnull SMIConversationQueryCompletion)completion;

    Swift

    func conversations(withLimit limit: UInt, sortedByActivityDirection direction: ListAPIDirections?) async throws -> [any Conversation]

    Parameters

    limit

    The maximum number of conversations to return in the query.

    direction

    The direction based on last activity. Default value is SMIListAPIDirectionsDescending.

    completion

    The completion that contains the result of the search query.

  • Marks a conversation entry as read.

    Note

    Only messages from remote participants should be provided. If the participant on the entry is local, this results in a no-op.

    Declaration

    Objective-C

    - (void)markAsRead:(nonnull id<SMIConversationEntry>)entry;

    Swift

    func markAsRead(entry: any ConversationEntry)

    Parameters

    entry

    The entry to mark as read.

  • Attempts to retry a message delivery. If the message status is not SMIConversationEntryStatusError, the entry is ignored.

    Declaration

    Objective-C

    - (void)retryEntry:(nonnull id<SMIConversationEntry>)entry;

    Swift

    func retry(_ entry: any ConversationEntry)

    Parameters

    entry

    The message to attempt to retry.

  • Attempts to retry a message delivery and submit pre-chat fields with the entry. If the message status is not SMIConversationEntryStatusError, the entry is ignored.

    Declaration

    Objective-C

    - (void)retryEntry:(nonnull id<SMIConversationEntry>)entry
        remoteConfiguration:(id<SMIRemoteConfiguration> _Nullable)remoteConfig;

    Swift

    func retry(entry: any ConversationEntry, remoteConfiguration remoteConfig: (any RemoteConfiguration)?)

    Parameters

    entry

    The message to attempt to retry.

    remoteConfig

    The remote configuration fields.

  • Deprecated

    Will be removed in a future version. Use retryEntry:remoteConfiguration:

    Attempts to retry a message delivery and submit pre-chat fields with the entry. If the message status is not SMIConversationEntryStatusError, the entry is ignored.

    Declaration

    Objective-C

    - (void)retryEntry:(nonnull id<SMIConversationEntry>)entry
              preChatFields:(nullable NSArray<id<SMIPreChatField>> *)preChatFields
        hiddenPreChatFields:
            (nullable NSArray<id<SMIHiddenPreChatField>> *)hiddenPreChatFields;

    Swift

    func retry(_ entry: any ConversationEntry, preChatFields: [any PreChatField]?, hiddenPreChatFields: [any HiddenPreChatField]?)

    Parameters

    entry

    The message to attempt to retry.

    preChatFields

    The visible pre-chat fields to be resubmitted.

    hiddenPreChatFields

    The hidden fields to be resubmitted.

  • Adds a delegate to listen to SMICoreDelegate events.

    Declaration

    Objective-C

    - (void)addDelegate:(nonnull id<SMICoreDelegate>)delegate;

    Swift

    func addDelegate(delegate: any CoreDelegate)

    Parameters

    delegate

    The delegate to add.

  • Adds a delegate to listen to SMICoreDelegate events. It is recommended that the main queue is passed to this method if you plan to handle events directly with changes to the UI.

    Declaration

    Objective-C

    - (void)addDelegate:(nonnull id<SMICoreDelegate>)delegate
                  queue:(nonnull dispatch_queue_t)queue;

    Swift

    func addDelegate(delegate: any CoreDelegate, queue: dispatch_queue_t)

    Parameters

    delegate

    The delegate to add.

    queue

    The dispatch queue to listen for events.

  • Sets the templatedUrlDelegate while also defining the dispatch queue that events fired to this delegate will be emitted to. It is recommended that the main queue is passed to this method if you plan to handle events directly with changes to the UI.

    Declaration

    Objective-C

    - (void)setTemplatedUrlDelegate:
                (nonnull id<SMITemplatedUrlDelegate>)templatedUrlDelegate
                              queue:(nonnull dispatch_queue_t)queue;

    Swift

    func setTemplatedUrlDelegate(delegate templatedUrlDelegate: any TemplatedUrlDelegate, queue: dispatch_queue_t)

    Parameters

    templatedUrlDelegate

    The delegate to add.

    queue

    The dispatch queue to listen for events.

  • Sets the preChatDelegate while also defining the dispatch queue that events fired to this delegate will be emitted to. It is recommended that the main queue is passed to this method if you plan to handle events directly with changes to the UI.

    Declaration

    Objective-C

    - (void)setPreChatDelegate:
                (id<SMIHiddenPreChatDelegate> _Nullable)preChatDelegate
                         queue:(nonnull dispatch_queue_t)queue;

    Swift

    func setPreChatDelegate(delegate preChatDelegate: (any HiddenPreChatDelegate)?, queue: dispatch_queue_t)

    Parameters

    preChatDelegate

    The delegate to add.

    queue

    The dispatch queue to listen for events.

  • Sets the userVerificationDelegate while also defining the dispatch queue that events fired to this delegate will be emitted to. It is recommended that the main queue is passed to this method if you plan to handle events directly with changes to the UI.

    Declaration

    Objective-C

    - (void)setUserVerificationDelegate:
                (nonnull id<SMIUserVerificationDelegate>)userVerificationDelegate
                                  queue:(nonnull dispatch_queue_t)queue;

    Swift

    func setUserVerificationDelegate(delegate userVerificationDelegate: any UserVerificationDelegate, queue: dispatch_queue_t)

    Parameters

    userVerificationDelegate

    The delegate to add.

    queue

    The dispatch queue to listen for events.

  • Removes the delegate to stop receiving events.

    Declaration

    Objective-C

    - (void)removeDelegate:(nonnull id<SMICoreDelegate>)delegate;

    Swift

    func removeDelegate(delegate: any CoreDelegate)

    Parameters

    delegate

    The delegate to remove.

  • Deprecated

    Will be removed in a future version. Use destroyStorageAndAuthorization:completion:

    Deletes the In-App Message store. This will reset all conversation as well as authorization credentials. By default this will also clear all auth credentials.

    Declaration

    Objective-C

    - (void)destroyStorage:(nonnull SMIDataOperationCompletion)completion;

    Swift

    func destroyStorage() async throws

    Parameters

    completion

    Completion block that returns with the success or failure of the operation.

  • Deletes the In-App Message store. This will reset all conversation as well as authorization credentials. By default this will also clear all auth credentials.

    Declaration

    Objective-C

    - (void)destroyStorageAndAuthorization:(BOOL)destroyAuthorization
                                completion:
                                    (nonnull SMIDataOperationCompletion)completion;

    Swift

    func destroyStorage(andAuthorization destroyAuthorization: Bool) async throws

    Parameters

    destroyAuthorization

    determines whether the authorization store will be cleared with this operation.

    completion

    completion block that returns with the success or failure of the operation.

  • De-registers the device from receiving push notifications. After this command has been executed, to receive push notifications again, the device will need to be registered again by calling -provideDeviceToken: on the CoreFactory.

    Declaration

    Objective-C

    - (void)deregisterDeviceWithCompletion:
        (nullable SMIDataOperationCompletion)completion;

    Swift

    func deregisterDevice() async throws

    Parameters

    completion

    Returns the result of the operation. If error is nil, the request is successful.

  • Revokes the authorization credentials associated with this configuration and optionally de-registers the device from receiving push notifications.

    Declaration

    Objective-C

    - (void)revokeTokenAndDeregisterDevice:(BOOL)deregisterDevice
                                completion:
                                    (nullable SMIDataOperationCompletion)completion;

    Swift

    func revokeTokenAndDeregisterDevice(_ deregisterDevice: Bool) async throws

    Parameters

    deregisterDevice

    Whether or not to also de-register device from push notifications.

    completion

    Returns the result of the operation. If error is nil, the request is successful.

  • Revokes the authorization credentials associated with this configuration and de-registers the device from receiving push notifications.

    Note

    This method automatically de-registers the device from receiving push notifications. If you don’t want to de-register the device, use -revokeTokenAndDeregisterDevice:completion: and set deregisterDevice to false.

    Declaration

    Objective-C

    - (void)revokeTokenWithCompletion:
        (nullable SMIDataOperationCompletion)completion;

    Swift

    func revokeToken() async throws

    Parameters

    completion

    Returns the result of the operation. If error is nil, the request is successful.