Skip to main content

2. Initialise the SDK

The DataSapien Mobile SDK is what runs Journeys, stores MeData on-device and talks to the Orchestrator. You add it to your app once and initialise it on every app launch.

There is a full installation guide for each platform — they cover dependencies, manifests/Info.plist, OAuth redirect setup and capabilities. Pick yours:

Follow the full guide: Install the SDK on iOS.

The minimum to initialise the SDK looks like:

import DataSapien

let config = DataSapienConfig
.Builder()
.setAuth(
url: "<YOUR_AUTH_URL>",
clientId: "<YOUR_CLIENT_ID>",
clientSecret: "<YOUR_CLIENT_SECRET>",
scope: "<YOUR_AUTH_SCOPE>"
)
.setHost(
baseUrl: "<YOUR_HOST_URL>",
mediaUrl: "<YOUR_MEDIA_URL>"
)
.setdebug(true)
.build()

DataSapien.initialize(dataSapienConfig: config)
DataSapien.setup { result in
switch result {
case .success: break // SDK ready
case .failure(let e): print(e)
}
}

Why two calls?

initialize() registers the configuration and prepares the SDK. setup() syncs MeData Definitions, Audiences, Journeys, Rules and models from your Orchestrator. Call setup() on every launch — the SDK only fetches optimised deltas.

Check SDK is running

Run your app and confirm the SDK reports a successful setup (in debug mode you'll see logs in the device console). With the SDK ready, the rest of this guide is in the Orchestrator UI.