Skip to content
Chumbaq

Quick start

iOS

Three calls: start the SDK, tell it who the user is, and turn on push. Ten minutes if your push setup already works.

1. Install

Package.swift
.package(url: "https://github.com/sohelyadav/chumbaq-ios-sdk", from: "0.1.0")

Four products: ChumbaqCore is required; add ChumbaqPush, ChumbaqMessages and ChumbaqBanners only if you use them.

2. Start the SDK and identify the user

Find your API key and project ID in your project's settings. Read them from your app's config rather than hard-coding them. Call identify right after login with your own user ID.

app start-up
import ChumbaqCore

let config = ChumbaqConfig.Builder(
    baseUrl: "https://your-chumbaq-host",
    apiKey: "<project API key>",
    projectId: "<project id>"
).build()

Chumbaq.shared.initialize(config: config)

// Who this is, once they log in.
try await Chumbaq.shared.identify(
    IdentifyParams.Builder().externalUserId("u_42").build()
)

3. Turn on push

Images, carousels and action buttons need a Notification Service extension (and a Content extension for carousels and countdowns). See Push setup.

push
import ChumbaqPush

ChumbaqPush.shared.initialize()
try await ChumbaqPush.shared.registerToken(deviceToken)   // Data or String

// From the app's own notification handlers.
ChumbaqPush.shared.reportNotificationDelivered(userInfo: userInfo)

// A tap, from didReceive(_:withCompletionHandler:).
if let destination = ChumbaqPush.shared.reportNotificationResponse(response) {
    router.go(destination)
}

4. Show in-app messages

Tell the SDK when the app opens, which screen is showing and what the user did. Messages wait for their trigger, and the native SDK draws them.

in-app triggers
import ChumbaqMessages

ChumbaqMessages.shared.messageListener = self

ChumbaqMessages.shared.onAppOpen()              // app foreground
ChumbaqMessages.shared.onScreenView("Home")     // screen change
ChumbaqMessages.shared.onEvent("purchase")      // custom event

Next