Getting started
The Ada iOS SDK is a framework that you can use to embed your Ada AI agent into your native iOS application.
It also supports actions and settings that you can use to customize the behavior of your AI Agent. For example, you might want to set the language, or pass metadata. The iOS SDK reference covers these options and more.
You’ll need an active Ada AI Agent handle and access to the Ada Dashboard to use the SDK. To gain access, please reach out to an Ada Account Manager.
This guide covers the new Ada iOS SDK. If you are migrating from the existing SDK (AdaEmbedFramework), see Upgrade from the Existing iOS SDK below.
Compatibility
Ada supports iOS 15.4 or later. Ada tests new iOS versions when they become generally available and continues testing the two versions behind the current version.
Install the iOS SDK
You can install the Ada iOS SDK using Swift Package Manager, CocoaPods, Carthage, or manually. Swift Package Manager is the recommended installation path.
Install using Swift Package Manager (Recommended)
Via Xcode:
- Open File > Add Package Dependencies…
- Enter the repository URL:
https://github.com/ada-cx-public/messaging-ios.git - Choose the release version you want to ship.
- Add the
AdaMessagingproduct to your app target.
Via Package.swift:
Replace <version> with the latest release tag from the releases page.
Install using CocoaPods
-
Add
AdaMessagingto your Podfile. -
Install the pod using:
pod install.
Replace <version> with the latest release tag from the releases page. The :tag pin is exact, so update it when you upgrade.
Install using Carthage
Add the following to your Cartfile:
Replace <version> with the latest release tag from the releases page.
Then run:
Add AdaMessaging.xcframework to your app target in Xcode.
Install iOS SDK manually
- Download
AdaMessaging.xcframework.zipfrom the latest release here. - Right-click on the project file in Xcode, then click Add Files to MyProjectName. Ensure that the groups option is selected.
- Set your Deployment Target to 15.4 or later.
- In your target’s General settings, add
AdaMessaging.xcframeworkunder Frameworks, Libraries, and Embedded Content with Embed & Sign selected.
Import the framework
Once you’ve installed the Ada iOS SDK, you’re ready to use it in your app!
- Import
AdaMessaginginto your controller. - Create an instance of the
AdaWebHost, as in the example below, replacingmy-botwith the actual name of your bot.
The lazy property prevents AdaWebHost from initializing until the property is used. Use of this property may help to prevent unwanted end users from being created in the background.
You can also pass optional configuration at initialization:
Most apps only need handle. Leave cluster and domain unset unless Ada tells you your AI agent is hosted on a non-default regional cluster or custom domain.
Choose the web runtime
AdaWebHost can mount one of two web runtimes inside its WebView:
.legacy(the default) — the same runtime the existing Chat SDK loads. Apps migrating fromAdaEmbedFrameworkkeep this default and see no behavior change..messaging— the Messaging runtime. Identity tokens, headless mode, andsendMessagerequire it.
To mount the Messaging runtime, set both environment and webSdk:
The Messaging runtime requires an explicit environment. If you set webSdk: .messaging without environment, the host falls back to the legacy path.
Launch Ada
Finally, launch Ada using one of the four opening methods:
launchModalWebSupport— Presents the chat as a modal overlay.launchNavWebSupport— Pushes the chat onto the navigation stack.launchInjectingWebSupport— Injects the chat view into an existing view.launchHeadlessWebSupport— Runs the chat offscreen, with no Ada UI. See Run headless and build your own UI.
Authenticate end users with an identity token
If your app has signed-in users, you can authenticate them to Ada with a short-lived identity token. This requires the Messaging runtime.
- Your backend mints a token for the signed-in user’s end user ID with the Ada Platform API (
POST /v2/auth/tokens/), authenticated with your Ada API key. Tokens are single use and expire after 15 minutes. - Your backend returns the token to your app over your own authenticated channel.
- Your app passes the token to
AdaWebHostat initialization.
The SDK exchanges the token once, when the session starts. Because tokens are single use, mint a fresh token for each new AdaWebHost you create.
Treat the identity token as a credential. Never log it, and never store it on the device. Never mint tokens from the app itself; that would require shipping your Ada API key in the app.
The SDK keeps the token out of every URL and never persists it. If the exchange fails, the runtime emits the ada:identity_token:error or ada:identity_token:expired event to your eventCallbacks. See identityToken in the reference.
Run headless and build your own UI
Headless mode runs the conversation in a hidden WebView while your app renders its own UI with native components. Use it for an unread badge, a custom chat screen, a search bar, or a command palette.
Create the host with headless: true and enableProgrammaticControl: true, then launch it without presenting UI. For example, to drive a native unread badge:
The ada:message:received event fires for each message from the AI Agent or a human agent. The ada:message:sent event fires for each message the end user sends. Both events require enableProgrammaticControl: true.
launchHeadlessWebSupport requires webSdk: .messaging, and stops the program with a precondition failure on the legacy runtime. It also forces headless to true: when the host was created with headless: false, the SDK rebuilds the WebView, which costs an extra load. Set both at initialization, as in the example above.
Events arrive only while your app is running in the foreground. iOS suspends the WebView with your app, so headless mode is not a background service. Use push notifications (setDeviceToken) to reach users outside the app lifecycle. See Headless session lifecycle for all constraints.
Runtime commands
You can interact with the Ada chat instance at runtime using the following methods.
Set metadata
Use MetaFields.Builder to pass public or sensitive metadata to Ada:
Dictionary overloads for setMetaFields and setSensitiveMetaFields still exist for backward compatibility but are deprecated. Use MetaFields.Builder for all new code.
Set language
Set device token
Send a message
sendMessage requires the Messaging runtime and enableProgrammaticControl: true. Calls made before the runtime is ready are queued and dispatched when it becomes ready.
Reset the chat
Delete chat history
Info.plist permissions
If your AI Agent flow allows users to upload images, videos, or use the camera, add the corresponding usage descriptions to your app’s Info.plist:
Upgrade from the existing iOS SDK
If you are migrating from the existing AdaEmbedFramework, the new Messaging SDK is designed as a drop-in replacement. AdaWebHost remains the main public class — most apps only need a dependency swap and an import rename.
Migration steps
- Replace the old dependency with
AdaMessaging. - Rename the framework import from
AdaEmbedFrameworktoAdaMessaging. - Keep your existing
AdaWebHostusage as-is.
Side-by-side mapping
Before / after: imports
Before / after: CocoaPods
Use MetaFields.Builder for new code
Dictionary overloads for setMetaFields, setSensitiveMetaFields, and some reset shapes still exist for backward compatibility but are deprecated. For all new code, prefer MetaFields.Builder:
Release checklist
Before shipping your integration or migration to production:
- Verify your real production AI Agent handle launches successfully
- Test the exact presentation mode you ship (modal, navigation push, inline, or headless)
- Confirm any event logging still receives SDK events
- Test push token registration if your app depends on it
- Test
reset()anddeleteHistory()if your app exposes those actions - If you use identity tokens, verify the happy path and confirm your code handles
ada:identity_token:errorandada:identity_token:expired - If you use headless mode, verify your native UI updates from
eventCallbacksand thatsendMessagedelivers