Skip to main content
Private beta. In-App Messaging is not yet generally available. To enable it for your workspace, contact your account manager or email support@gameball.co.

Display In-App Messages

One call after you identify the customer, and the Gameball SDK draws your dashboard campaigns above your app in its own window: slide-ups, modals, and full screens, triggered by session start or by the events you already send. The module is dormant until you start it, so upgrading a widget-only integration changes nothing. For campaign options, triggers, filters, priority, cooldown, quiet hours, and how the analytics are defined, see In-App Messaging Campaigns.

Requirements


Install

Private beta build. The SDK is not published to the public package registries, so the version below is a placeholder. To get the build and its version, contact your account manager or email support@gameball.co.
Initialize the SDK and identify the customer as you do today:

Start Messaging

Call startInAppMessaging() once. It uses the customer already identified with the SDK. Call it before initializeCustomer and the module starts as soon as a customer is identified, or pass an ID explicitly.
Starting is idempotent for the same customer. Starting for a different customer refetches campaigns and resets frequency history, so you never need to stop first. Call stopInAppMessaging() on logout; it is safe when messaging was never started. App lifecycle is observed automatically.

Control Display and Actions

Assign a GameballInAppMessagingDelegate to inAppMessagingDelegate, before or after starting. Every method has a default, so implement only what you need.
The delegate is held weakly. Keep your own strong reference, or your hooks stop firing as soon as the object is deallocated.
Each hook is called on the main thread and individually guarded. A throwing or odd return loses that override, never the message.

Actions

GameballClickAction is an enum, so an exhaustive switch is safe.

Events and Purchases

Events you already send drive the triggers, and there is nothing extra to call. The event’s properties are what campaign filters read, so send numbers as numbers where a filter compares them.
Purchases have a dedicated entry point and reach campaigns as the reserved event purchase, with productId, price, currency, and quantity folded into its properties:

Language

There is no separate language setting for messages. Each sync asks for the customer’s preferred language when your app set one, otherwise the lang given at init, otherwise the device language. The value is resolved on every sync, so a language change picked up by initializeCustomer applies at the next session. Right-to-left languages mirror the layout through directional constraints. The SDK never touches UIView.appearance().

Push Permission

The request push permission button action calls UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]), logs the outcome, and closes the message. The click is reported the same way whether the customer allows or declines.
To run your own pre-prompt or permission flow, handle .requestPushPermission in gameballDidHandleAction and return true.

SwiftUI and UIKit

The module needs no view hierarchy from you. It attaches its window to the foreground UIWindowScene, so it works the same in a SwiftUI App and in a UIKit app with a scene delegate. Keep the delegate object alive for as long as you want the hooks, for example as a property of your app model.

Behavior Reference

These rules are shared with every Gameball SDK and are described in full in In-App Messaging Campaigns. This is what they mean in an iOS app.

Logging and Troubleshooting

Every decision is printed to the console with a [GameballIAM] prefix and the campaign ID. It is always on and is never posted to the backend. Filter Xcode’s console on the prefix.
Nothing shows at all? Check in order: init ran with the API key and a customer is identified, startInAppMessaging was called, the campaign is live and targets iOS and the customer is in its audience, the sync log lists it, the account cooldown or quiet hours are not suppressing it, and the campaign has not already been shown to this customer. Once per customer is the default. A fresh customer ID resets frequency history while testing.

API Reference


Launch Checklist

1

Initialize and identify

init with the production API key, then initializeCustomer with a preferredLanguage.
2

Start and stop messaging

startInAppMessaging() once the customer is known, and stopInAppMessaging() on logout.
3

Keep a delegate alive

A delegate object retained by your app, with gameballShouldNavigate wired if any campaign uses navigate.
4

Check event property types

Events carry numeric properties as numbers where campaigns filter on them.
5

Test end to end

Run one campaign on a fresh customer ID with the Xcode console filtered on [GameballIAM].

In-App Messaging Campaigns

Campaign options, triggers, delivery rules, and analytics definitions.

Track Events

Send the events your campaigns are triggered by.

Push Notifications

Reach customers when the app is closed.

Go-Live Checklist

Verify the full iOS integration before release.