iOS SDK reference

Use the iOS SDK settings and actions to customize the behavior of your bot.

Settings

With the iOS SDK, you can customize the behavior of your chatbot with AdaWebHost input parameters.

appScheme

appScheme: String = ""

Use this setting to pass the scheme name of the host app. This allows for more robust handling of universal links.

cluster

cluster: String = ""

Specifies the Kubernetes cluster to be used. You should not change this value unless directed by an Ada team member.

greeting

greeting: String = ""

Use to customize the greeting messages that new chatters see. This is useful for setting view-specific greetings across your app. The greeting should correspond to the ID of the Answer you would like to use, which you can find in the URL of the corresponding Answer in the dashboard.

Example

handle

handle: String

The handle for your bot. This is a required field.

language

language: String = ""

Takes in a language code to programatically set the bot language. You must first turn languages on in your Ada dashboard.

📘

Language codes use the ISO 639-1 language format.

metaFields

metafields: [String: String]? = [:]

Use metaFields to pass information about a chatter to Ada. This can be useful for tracking information about your customers, as well as personalizing their experience. For example, you may wish to track the phone_number and name for conversation attribution. (See Variables for more information.)

Once set, you can access this information:

  • in the email attachment from Handoff Form submissions
  • via the Meta variables modal in the Conversations page of your Ada dashboard

To change these values after bot setup, use the setMetaFields action.

lazy var adaFramework = AdaWebHost(handle: "ada-example", metafields: ["tier": "pro"])

sensitiveMetafields

sensitiveMetafields: [String: String]? = [:]

Use this parameter to pass sensitive meta information about a chatter. This works like metafields but provides an added layer of security. To change these values after bot setup, use the setSensitiveMetafields action.

openWebLinksInSafari

openWebLinksInSafari: Bool = false

External web links now open by default in-app, via the SFSafariViewController. To open external links in the Safari browser, pass openWebLinksInSafari: true to AdaWebHost.

zdChatterAuthCallback

zdChatterAuthCallback: ((((_ token: String) -> Void)) -> Void)? = nil

Use the zdChatterAuthCallback to request a JWT token from your API, then pass it to Ada. This creates shared trust between Ada and Zendesk, and in turn allows for verifiable chatter identity.

lazy var adaFramework = AdaWebHost(handle: "nic", zendeskAuthCallback: { callback in
    // Request JWT from your API
    // Then...
    callback("your.JWT")
})

Actions

Use the actions below in conjunction with settings to customize the behavior of your bot in an iOS app.

deleteHistory

deleteHistory()

Deletes the chatter used to fetch conversation logs for a chatter from storage. When a user opens a new chat window, a new chatter is generated.

launchInjectingWebSupport

launchInjectingWebSupport(into view: UIView)

Launches Ada chat into a specified subview.

adaFramework.launchInjectingWebSupport(into: injectingView)

launchModalWebSupport

launchModalWebSupport(from viewController: UIViewController)

Launches Ada chat in a modal view over top of your current view.

adaFramework.launchModalWebSupport(from: self)

launchNavWebSupport

launchNavWebSupport(from navController: UINavigationController)

Pushes a view containing Ada chat to the top of your navigational stack.

adaFramework.launchNavWebSupport(from: navigationController)

reset

reset()

Use this action to create a new chatter and refresh the chat window.

setLanguage

setLanguage(language: string)

Changes the language in chat programatically. Use this action, rather than the language setting, to change the chat language without clearing the chat history. Language codes must use a lowercase, two-letter code, in ISO 639-1 language format. For example, en, fr, ca, ar, and so on.

adaFramework.setLanguage(language: "fr")

Before using setLanguage:

  • You must turn languages on in your Ada dashboard.

  • The chat window must be opened at least once.

setMetaFields

setMetaFields(_ fields: [String: Any])

Used to set metadata for a chatter after instantiation. This is useful if you need to update user data after Ada Chat has already launched. See also metaFields.

adaFramework.setMetaFields([
    "firstName": "Jane",
    "lastName": "Doe",
    "tier": "pro"
])

setSensitiveMetaFields

setSensitiveMetaFields(_ fields: [String: Any])

Used to set sensitive metadata for a chatter after instantiation. This works like setMetaFields and is useful for storing more private and sensitive information. See also sensitiveMetaFields.

adaFramework.setSensitiveMetaFields([
  "token": "your_jwt_token"
])

triggerAnswer

triggerAnswer()

Triggers an answer in chat. Include the Answer ID, which you can find in the URL of the corresponding Answer in the dashboard.

Example

adaFramework.triggerAnswer("627d28a9bd9ca9e5337b9763")

📘

The chat window must be opened at least once before this method can be used.