API Reference
SetupConfiguration
/**
Initializes the Chatvisor SDK Configuration.
*/
init(tenantId: String, token: String)
- (nonnull instancetype)initWithTenantId:(NSString * _Nonnull)tenantId token:(NSString * _Nonnull)token;
Additional configuration options
/**
Set server URL to which SDK connects to
*/
func setServerUrl(_ serverUrl: String)
- (void)setServerUrl:(NSString * _Nonnull)serverUrl;
/**
Set CDN URL to which SDK connects to
*/
func setCdnUrl(_ cdnUrl: String)
- (void)setCdnUrl:(NSString * _Nonnull)cdnUrl;
Chatvisor
/**
Initializes the Chatvisor SDK.
- Parameter config SetupConfiguration instance
*/
static func setup(with config: SetupConfiguration)
+ (void)setupWith:(SetupConfiguration * _Nonnull)config;
Chatvisor.coBrowsing
Start session
/**
Starts a new session
*/
func start()
- (void)start;
/**
Starts a new session
- Parameter result success: shareId: String or failure: Error
*/
func start(_ result: @escaping (LiveView.ChatvisorResult) -> Void)
- (void)start:(void (^ _Nonnull)(ChatvisorResult * _Nonnull))result;
Stop session
/**
Disconnects the current cobrowsing-session
*/
func stop() -> Void
- (void)stop;
Retrieve connection state
/**
Returns the current connection state
*/
func connectionState() -> LiveView.ChatvisorConnectionState
- (ChatvisorConnectionState)connectionState;
Monitor connection state
/**
Registers callback for connection state changes
- Parameter callback: Called when a session connection state changes
*/
func onConnectionStateChange(callback: LiveView.ConnectionStateResult?)
- (void)onConnectionStateChangeWithCallback:(ConnectionStateResult _Nullable)callback;
Retrieve Share Id
/**
Returns the share Id to identify the session
*/
func shareId() -> String?
- (NSString * _Nullable)shareId
/**
Enables or disables the default Co-Browsing UI
*/
func setUIEnabled(_ enabled: Bool)
- (void)setUIEnabled:(Boolean)enabled;
Chatvisor.liveView
Start session
/**
Starts a new session
*/
func start()
- (void)start;
/**
Starts a new session
- Parameter result success: shareId: String or failure: Error
*/
func start(_ result: @escaping (LiveView.ChatvisorResult) -> Void)
- (void)start:(void (^ _Nonnull)(ChatvisorResult * _Nonnull))result;
Stop session
/**
Disconnects the current cobrowsing-session
*/
func stop() -> Void
- (void)stop;
Retrieve connection state
/**
Returns the current connection state
*/
func connectionState() -> LiveView.ChatvisorConnectionState
- (ChatvisorConnectionState)connectionState;
Monitor connection state
/**
Registers callback for connection state changes
- Parameter callback: Called when a session connection state changes
*/
func onConnectionStateChange(callback: LiveView.ConnectionStateResult?)
- (void)onConnectionStateChangeWithCallback:(ConnectionStateResult _Nullable)callback;
Retrieve Share Id
/**
Returns the share Id to identify the session
*/
func shareId() -> String?
- (NSString * _Nullable)shareId;
Tag session
/**
Tags the current active session with a custom string value
- Parameter tag: Tag name as string
*/
func tag(_ tag: String)
- (void)tag:(NSString * _Nonnull)tag;
/**
Tags the current active session with a custom string value
- Parameter tag: Tag name as string
- Parameter result: success: Some or failure: Error
*/
func tag(_ tag: String, _ result: @escaping (LiveView.ChatvisorResult) -> Void)
- (void)tag:(NSString * _Nonnull)tag result:(void (^ _Nonnull)(ChatvisorResult * _Nonnull))result;
Chatvisor.liveView.ConnectionStateResult
/**
Connection state callback typealias
*/
public typealias ConnectionStateResult = (_ state: LiveView.ChatvisorConnectionState) -> Void
Chatvisor.webChat
Show chat
/**
Opens the web chat
*/
func open()
- (void)open;
/**
Opens the web chat
- Parameter result success: Some or error
*/
func open(_ result: @escaping (LiveView.ChatvisorResult) -> Void)
- (void)open:(void (^ _Nonnull)(ChatvisorResult * _Nonnull))result;
Request notification permissions
/**
Asks for notification authorization on the first call.
Registers the application for remote notifications.
Call this function when the permissions should be requested but in any case after initialization.
Notifications can only be received after this function is executed.
*/
func requestNotificationAuthorization() -> Void
- (void)requestNotificationAuthorization;
Forward user opening notification
/**
Opens the chatvisor chat for a received notification.
Call this function in application(_:didReceiveRemoteNotification:)
to open the chatvisor chat when the user taps on a chatvisor notification.
*/
func didReceiveRemoteNotification(userInfo: [AnyHashable : Any]) -> Void
- (void)didReceiveRemoteNotificationWithUserInfo:(NSDictionary * _Nonnull)userInfo;
Setup UNUserNotificationCenterDelegate
/**
Sets the UNUserNotificationCenter delegate.
Call this function from your application(_:willFinishLaunchingWithOptions:) or
application(_:didFinishLaunchingWithOptions:)
*/
func setupUNUserNotificationCenterDelegate() -> Void
- (void)setupUNUserNotificationCenterDelegate;
Forward notifications when app is in foreground
/**
Checks if the chat is already open. If not, it creates a notification.
Call this function in your UNUserNotificationCenter delegate's userNotificationCenter(_:willPresent:withCompletionHandler:).
This function returns true when it handles the notification and calls the completionHandler, false otherwise.
*/
func processesNotification(notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) -> Void
- (BOOL)processesNotificationWithNotification(UNNotification * _Nonnull)notification withCompletionHandler:(void (^ _Nonnull)(UNNotificationPresentationOptions))completionHandler SWIFT_WARN_UNUSED_RESULT;
Initialize Firebase
/**
Sets the FirebaseMessaging.FIRMessaging delegate.
Call this function from your application(_:willFinishLaunchingWithOptions:) or
application(_:didFinishLaunchingWithOptions:) if you do already have a custom
UNUserNotificationCenter delegate but no FIRMessaging delegate.
This function is called by initNotifications()
*/
func initFirebase() -> Void
- (void)initFirebase SWIFT_METHOD_FAMILY(none);
Setup Messaging delegate
/**
Sets the FirebaseMessaging.FIRMessaging delegate.
Call this function from your application(_:willFinishLaunchingWithOptions:) or
application(_:didFinishLaunchingWithOptions:)
*/
func setupMessagingDelegate() -> Void
- (void)setupMessagingDelegate;
Forward a new device token to the chatvisor SDK
/**
Notifies the server about a new mobile device token.
*/
func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: Data) -> Void
- (void)messaging:(FIRMessaging * _Nonnull)messaging didReceiveRegistrationToken:(NSString * _Nonnull)fcmToken;
Chatvisor.user
Tag user
/**
Tags the current or any following session with the given user information until clear() is called
- Parameter user: ActiveUser instance
*/
tag(_ user: ActiveUser)
- (void)tag:(ActiveUser * _Nonnull)user;
/**
Tags the current or any following session with the given user information until clear() is called
- Parameter user: ActiveUser instance
- Parameter result: success: Some or failure: Error
*/
tag(_ user: ActiveUser, _ result: @escaping (ChatvisorResult) -> Void)
- (void)tag:(ActiveUser * _Nonnull)user result:(void (^ _Nonnull)(ChatvisorResult * _Nonnull))result;
Clear tag
/**
Clears a user tag
*/
func clear() -> Void
- (void)clear;
Chatvisor.conference
Start conference
/**
Starts a video conference
- Parameter conferenceProperties conference properties with customer id
- Parameter showInviteDialog shows invite dialog before starting a conference
*/
func start(conferenceProperties: ConferenceProperties, showInviteDialog: Bool = false)
- (void)startWithConferenceProperties:(ConferenceProperties * _Nonnull)conferenceProperties showInviteDialog:(BOOL)showInviteDialog = false;
/**
Starts a video conference
- Parameter conferenceProperties conference properties with customer id
- Parameter showInviteDialog shows invite dialog before starting a conference
- Parameter result: success: Some or failure: Error
*/
func start(conferenceProperties: ConferenceProperties, showInviteDialog: Bool, _ result: @escaping (ChatvisorResult) -> Void)
- (void)startWithConferenceProperties:(ConferenceProperties * _Nonnull)conferenceProperties showInviteDialog:(BOOL)showInviteDialog result:(void (^ _Nonnull)(ChatvisorResult * _Nonnull))result;
Join conference queue
/**
Joins a video conference
- Parameter conferenceProperties conference properties with customer id
*/
func join(conferenceProperties: ConferenceProperties)
- (void)joinWithConferenceProperties:(ConferenceProperties * _Nonnull)conferenceProperties;
/**
Joins a video conference
- Parameter conferenceProperties conference properties with customer id
- Parameter result: success: Some or failure: Error
*/
func join(conferenceProperties: ConferenceProperties, _ result: @escaping (ChatvisorResult) -> Void)
- (void)joinWithConferenceProperties:(ConferenceProperties * _Nonnull)conferenceProperties result:(void (^ _Nonnull)(ChatvisorResult * _Nonnull))result;
Check queue status
/**
Sets a callback for queue status polling. After joining the queue the callback is called every few seconds with the position in the queue.
When the position is -1, the conference should be started by calling start(context, properties).
- Parameter completion pass completion block
*/
func queueStatus(completion: @escaping (Int)->())
- (void)queueStatusWithCompletion:(void (^ _Nonnull)(NSInteger))completion;