• Release Notes
  • User
  • Admin
  • Developers
  • Integrations

›iOS

General

  • Overview
  • LiveView / CoBrowsing / Session Recordings

JS API

  • Overview
  • CoBrowsing
  • LiveView / Session Recordings
  • WebChat
  • Web Calling
  • Video Conference
  • Logging
  • User
  • Team
  • API
  • Supported Browsers
  • Supported Technologies

Android

  • Overview
  • Installation
  • Usage
  • Reference
  • Licenses

iOS

  • Overview
  • Installation
  • Usage
  • Reference
  • Licenses

Flutter

  • Overview
  • Installation
  • Usage
  • Reference

Capacitor

  • Overview
  • Installation
  • Usage
  • Reference

Usage

Initialization

You may initialize the library any time during the life of your application. To make available any time, we recommend putting the call inside the application:didFinishLaunchingWithOptions: method of the class with the @UIApplicationMain annotation (called AppDelegate by default).

The simplest case looks like this:

Swift
Objective-C
import UIKit
import LiveView

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let configuration = SetupConfiguration(tenantId: "<your tenantId>", token: "<your token>")
Chatvisor.setup(with: configuration)
return true
}
}

#import "AppDelegate.h"
#import "LiveView/LiveView-Swift.h"

@interface AppDelegate ()

@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
SetupConfiguration *configuration = [[SetupConfiguration alloc] initWithTenantId:@"<your tenantId>" token:@"<your token>"];
[Chatvisor setupWith:configuration];
return YES;
}

@end

Alternatively (For custom cluster and configuarion) you may also initialize like this:

Swift
Objective-C
import UIKit
import LiveView

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let configuration = SetupConfiguration(tenantId: "<your tenantId>", token: "<your token>")
configuration.setServerUrl("<server URL>")
configuration.setCdnUrl("<CDN URL>")
config.setOverlayBackgroundColor("<UIColor>")
config.setControlsColor("<UIColor>")
Chatvisor.setup(with: configuration)
return true
}
}

#import "AppDelegate.h"
#import "LiveView/LiveView-Swift.h"

@interface AppDelegate ()

@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
SetupConfiguration *configuration = [[SetupConfiguration alloc] initWithTenantId:@"<your tenantId>" token:@"<your token>"];
[config setServerUrl:"<server URL>"];
[config setCdnUrl:"<CDN URL>"];
[Chatvisor setupWith:configuration];
return YES;
}

@end

User tagging

Users can be tagged using the Chatvisor.user.tag method. This usually happens when a user executes a login. It expects an object of type ActiveUser that takes the same arguments as the JavaScript API method. All fields are optional.

Swift
Objective-C
let user = ActiveUser()
user.id = "john.doe"
user.firstname = "John"
user.lastname = "Doe"
user.email = "john.doe@example.com"
user.labels = ["foo", "bar"]

Chatvisor.user.tag(user)
ActiveUser *user = [[ActiveUser alloc] init];
[user setId:@"john.doe"];
[user setFirstname:@"John"];
[user setLastname:@"Doe"];
[user setEmail:@"john.doe@example.com"];
[user setAssignedUser:@"mary.doe@company.com"];

NSArray *tags = [NSArray arrayWithObjects:@"foo", @"bar", nil];
[user setTags:tags];

[Chatvisor.user tag:user];

In case a value is passed in the id field, a new user object will be created in the backend and associated to this session. Also the session will be tagged with the id value.

If a user logs out of an account it is recommended to call Chatvisor.user.clear() to remove the tag from the session. This also stops the LiveView session.

ConferenceProperties

ConferenceProperties are used to start, join or gather queue status information about the Chatvisor.conference. All fields are optional but can be set in order to provide user information about who is starting or joining the conference.

Swift
Objective-C
let properties = ConferenceProperties()
properties.customerId = "john.doe"
properties.firstname = "John"
properties.lastname = "Doe"
properteis.displayName = "John Doe" // or "\(firstname) \(lastname)"
properties.email = "john.doe@example.com"
properties.phoneNumber = "+123 456 789"
ConferenceProperties *properties = [[ConferenceProperties alloc] init];
[properties setCustomerId:@"john.doe"];
[properties setFirstname:@"John"];
[properties setLastname:@"Doe"];
[properties setDisplayName:@"John Doe"];
[properties setEmail:@"john.doe@example.com"];
[properties setPhoneNumber:@"+123 456 789"];

Set up chat notifications

A flowchart with different setup options is at the bottom. When chat notifications are set up a user can receive push notifications when a chat message arrives as soon as the user is tagged.

If you have an on-premise installation, you need your own Firebase project for sending chat notifications. See the official documentation on how to set up a free Firebase project for Android. IMPORTANT: Type the bundle identifier all lowercase! You do not have to follow the whole process, you just need the GoogleService-Info.plist file.

Additionally, set

application:
    ...
    firebase-cloud-messaging:
        project_id: {project id}
        private_key_id: {private key id}
        private_key: {private key with removed header, footer and newlines}
        client_email: {client email}
        client_id: {client id}
        token_uri: {token uri}

in the application.yml of your server. You can find all necessaray data in the private key file (JSON) you can generate for a Google service account (See the official documentation). This service account just needs the permission "firebase.messaging" for sending notifications.

1. Permissions

First, check that the required capabilities "Notifications" and "Background Modes: Remote notifications" are enabled in your app (App Capabilities).

Call requestNotificationAuthorization() when you want to ask the user for permissions to show notifications. This also registers the app for remote notifications.

2. Forward notification actions

In order to start the chat when the app is opened by the user tapping on a chat notification call didReceiveRemoteNotification(userInfo) in your AppDelegate's application(_:didReceiveRemoteNotification:, _:fetchCompletionHandler:).

3. UNUserNotificationCenter

3.1 You don't have your own UNUserNotificationCenter delegate

Call setupUNUserNotificationCenterDelegate() in your application(_:willFinishLaunchingWithOptions:) or application(_:didFinishLaunchingWithOptions:) function in your AppDelegate.

3.2 You have your own UNUserNotificationCenter delegate

If you already have a UNUserNotificationCenter delegate you have to forward chatvisor notifications to the SDK.

func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler 
completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
  if Chatvisor.webChat.processesNotification(notification, withCompletionhandler: completionHandler) {
    return
  }   
  ...
  completionHandler(...)
}

4. Setup Firebase

Are you already using Google Firebase in your app? (Do you have a file named GoogleService-Info.plist in the root directory of your XCode project?)

  • Yes (4.1)
  • No (4.2)

4.1

Do you want to use your already configured default Firebase project for chatvisor notifications?

  • Yes (only possible for on-premise installations) (4.1.1)
  • No, I want/need to handle chatvisor notifications on a separate Firebase project (4.1.2)
4.1.1

Make sure you have an APN Authentication Key or see the Firebase documentation on how to get register one. You need an Apple Developer Account for that.

Do you already have a custom FIRMessagingDelegate (set by Messaging.messaging().delegate = MyCustomMessagingDelegate)?

  • Yes (4.1.1.1)
  • No (4.1.1.2)
4.1.1.1

Call updateToken(token: deviceToken) in your application(_:didRegisterForRemoteNotificationsWithDeviceToken:).

You are done!

4.1.1.2

Call setupMessagingDelegate() in your application(_:willFinishLaunchingWithOptions:) or application(_:didFinishLaunchingWithOptions:) function in your AppDelegate.

You are done!

4.1.2

Create a second FCM token in your application(_:didRegisterForRemoteNotificationsWithDeviceToken:) for chatvisor like so:

func application(_ application: Application, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
  Messaging.messaging().retrieveFCMToken(forSenderID: chatvisorSenderId) { (fcmToken, error) in
    if error == nil {
      Chatvisor.webChat.messaging(Messaging.messaging(), token: fcmToken!)
    }
  }
}

The chatvisorSenderId will be provided by Chatvisor. If you have an on-premise installation you have to use an own Firebase project. Consider using your default project (4.1.1) or create a new one and use its GCM sender ID which you can find in the Firebase Console in the Cloud Messaging settings. You also have to set up an APN Authentication Key.

You are done!

4.2

Do you have an on-premise installation?

  • Yes (4.2.1)
  • No (4.2.2)
4.2.1

You have to set up a Firebase project. See the official documentation on how to set up a Firebase project for iOS. IMPORTANT: Type the bundle identifier all lowercase! You do not have to follow the whole process, you just need the GoogleService-Info.plist file and upload your APNs authentication key.

Place the file in the root directory of your XCode project. Then continue with 4.2.2.

4.2.2

Call initFirebase() in your application(_:willFinishLaunchingWithOptions:) or application(_:didFinishLaunchingWithOptions:) function in your AppDelegate.

You are done!

Notifications setup overview

Credentials

You can create credentials for use in your application in the settings section of the Chatvisor application.

← InstallationReference →
  • Initialization
  • User tagging
  • ConferenceProperties
  • Set up chat notifications
    • 1. Permissions
    • 2. Forward notification actions
    • 3. UNUserNotificationCenter
    • 4. Setup Firebase
  • Credentials
MANUALS
User Manual: Sales Suite
Admin Manual: Sales Suite
User Manual: Support Suite
Admin Manual: Support Suite
DEVELOPERS
Integrations
REST API
SDK API
LEGAL
Privacy Policy
Terms and Conditions
Imprint
Engage
Copyright © 2024 TeamViewer Austria GmbH