iOS SDK

DeepConverse provides an easy to use SDK for integrating the chatbot into your app. To setup the SDK follow the steps below.

Installation

You can include the SDK by using Cocoapods and adding this into your Podfile

pod 'DeepConverse', :git => 'https://github.com/converselabs/ios-sdk.git', :branch => 'release'

Setup

Here is a sample ViewController showing how you can include the SDK and load the bot on the click action of a button. You can also pass in metadata to the chatbot.

You will require DOMAIN and BOT_NAME which can be found from the dashboard.

import UIKit

import DeepConverse

class ViewController: UIViewController {

    private var sdk : DeepConverseSDK? = nil  

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        var metadata = [String:String]()
        metadata["draft"] = "true"

        let session = DeepConverseSDKSession.init(
            subDomain: <DOMAIN>,
            botName: <BOT_NAME>,
            metadata: metadata,
            webViewTimeout: 60.0
        )

        sdk = DeepConverseSDK(delegate: self, session: session)
    }

    

    @IBAction func Click(_ sender: Any) {
        sdk?.openBot(viewController: self)
    }
}

extension ViewController: DeepConverseDelegate {

    func didWebViewFail(withError: DeepConverseWebHostError) {
        print("Did fail with error")
    }

    func didReceiveEvent(event: [String : Any]) {

    }

    func didCloseBot() {
        print("Did Close")
    }

    func didOpenBot() {
        print("Did Open")
    }
}

Last updated