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;
/**
Set the background color of the overlay in co-browsing
*/
func setOverlayBackgroundColor(_ overlayBackgroundColor: UIColor)
- (void)setOverlayBackgroundColor:(UIColor * _Nonnull)overlayBackgroundColor;
/**
Set the control buttons color of the overlay in co-browsing
*/
func setControlsColor(_ controlsColor: UIColor)
- (void)setControlsColor:(UIColor * _Nonnull)cdnUrl;
/**
Set sharing configuration
*/
func setSharingConfiguration(_ sharingConfig: SetupSharingConfiguration?)
- (void)setSharingConfiguration:(SetupSharingConfiguration * _Nonnull)sharingConfig;
SetupSharingConfiguration
/**
Initializes the Chatvisor SDK Sharing Configuration.
- Parameter appGroupId: App group ID eg. "group.[domain].[yourcompany].[yourapp]". Visit
https://developer.apple.com/documentation/xcode/configuring-app-groups for more information.
*/
public init(appGroupId: String)
- (nonnull instancetype)initWithAppGroupId:(NSString * _Nonnull)appGroupId;
/**
- Enables sharing and retrieving Co-Browsing sessions from the App group container. Default: false
Sessions are shared between different apps belogining to the same App group on the same device. When enabled,
Co-Browsing session will be shared with the App group on session start and deleted on session end by the initiator app.
Another app belonging to the same App group can retrieve the session and join it.
*/
var sessionSharingEnabled: Bool
@property (nonatomic, assign) BOOL sessionSharingEnabled;
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;
Join existing session
/**
Joins existing session
- Parameter session: SharedSession
- Parameter result success: shareId: String or failure: Error
*/
func join(session: SharedSession, _ result: @escaping (ChatvisorResult) -> Void)
- (void)join:(SharedSession*)session (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
Retrieve shared session
/**
Returns a Co-Browsing SharedSession instance if one exists within the App group or nil. SetupConfiguration must be configured with
an instance of SetupSharingConfiguration to enable this functionality. Sessions are shared with the App group when Co-Browsing
session starts and deleted when session ends by the session initiator app.
*/
func sharedSession() -> SharedSession?
- (SharedSession * _Nullable)sharedSession
/**
Enables or disables the default Co-Browsing UI
*/
func setUIEnabled(_ enabled: Bool)
- (void)setUIEnabled:(Boolean)enabled;
SharedSession
// Shared session descriptor object
/**
- Shared session ID.
*/
sessionId: String
/**
- Share ID. User / operator friendly version of sessionId
*/
shareId: String
/**
- Bundle ID of the session initiator app
*/
initiatorBundleId: String
/**
- CFBundleName of the session initiator app
*/
initiatorName: String
/**
- Date at which session started
*/
startedAt: Date
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;
Join existing session
/**
Joins existing session
- Parameter session: SharedSession
- Parameter result success: shareId: String or failure: Error
*/
func join(session: SharedSession, _ result: @escaping (ChatvisorResult) -> Void)
- (void)join:(SharedSession*)session (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;
Retrieve shared session
/**
Returns a SharedSession instance if one exists within the App group
*/
func sharedSession() -> SharedSession?
- (SharedSession * _Nullable)sharedSession
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;