Initialization

This section provides detailed instructions on how to initialize the ConpeekClient instance required to interact with the Conpeek application.

Prerequisites

Before you begin, ensure you have the following:

Conpeek SDK: Ensure that the Conpeek SDK is integrated into your project.

Configuration Details: You should have the following details provided by Conpeek:

  • Tenant Plugin API URL
  • SDK UUID
  • Configuration ID
  • Available media types (e.g., chat, audio, video)

How to Generate SDK UUID and obtain TenantPluginAPIURL and ConfigurationID

To obtain the necessary TenantPluginAPIURL and generate the SdkUUID, follow these steps:

  • Open the Conpeek application and go to tenant settings.
  • Select the Services option.
  • Navigate to the Mobile SDK settings view, located below the Plugin JS settings.
  • In this view, you will find a field to generate the SdkUUID and a section to obtain the TenantPluginAPIURL.

    Mobile SDK

To obtain the ConfigurationID, follow these steps:

  • In the top navigation bar, go to the Configuration Mobile SDK Configuration tab.
  • If you do not have any existing configurations, create a new one.
  • Copy the ConfigurationID from the list of available configurations.

    Mobile SDK documentation

Example

Step 1: Import necessary modules

First, import the necessary modules in your Swift file:

import Conpeek_iOS_SDK

Step 2: Example of the ClientViewModel

Create a new ClientViewModel class that conforms to ObservableObject and ClientDelegate. This class will manage the client functionality.

class ClientViewModel: ObservableObject, ClientDelegate {
    var dialog: Dialog?
    var client: ConpeekClient?

    // Initialize the client and set up necessary configurations.
    init() {
        initializeClient()
    }

    private func initializeClient() {
        do {
            client = try ClientBuilder()
                .setTenantPluginAPIURL("https://tenantpluginapiserver1.example.conpeek.com")
                .setSdkUUID("f7kca40c-aml4-8182-b9cd-6054970e614e")
                .setConfigurationID("664c996333f5de4528e15690")
                .setAvailableMedia(["chat","audio", "video"])
                .setDeviceID(UUID().uuidString)
                .setDelegate(self)
                .build()
        } catch {
            print("Error initializing client: \(error.localizedDescription)")
        }
    }

    // Example ClientDelegate methods...

    func onConnected() {
        // Called when successfully connected to API
    }

    func onDisconnected() {
        // Called when disconnected from API. Connect is handled automatically
    }

    func onInitializeFailure() {
        // Called when connecting to API failed
    }

    // Implement other ClientDelegate methods...
} 

By following these steps, you ensure that your Conpeek client is configured correctly and ready to interact with the Conpeek system.

Proceed to the next step: Make call.