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

Your dashboard campaigns, drawn natively in your React Native app: slide-ups, modals, and full screens, triggered by session start or by the events you already send. 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.
If you already use the SDK for the profile widget or event tracking, you have it. In-app messaging adds five methods and one component.

Mount the Surface

React Native has no window of its own to draw into, so the SDK needs a place in your tree. Mount <GameballInAppMessages /> once, near the root of your app and above your navigator.
App.tsx
Until it is mounted, nothing draws. The SDK will not count an impression nobody could see, so it holds the message and displays it once a surface exists. If messages never appear, this is the first thing to check. The log says no in-app messaging host mounted yet; deferring.
Slide-ups render in place, so the app underneath stays usable. Modals and full screens render inside a React Native Modal, which puts them above everything your app draws, including a navigator’s own screens, and gives Android’s Back button somewhere to land.

Start Messaging

Three calls, in order.
Await startInAppMessaging. Storage is asynchronous on this platform, and the frequency history has to be in memory before the first campaign is judged against it, or a once-ever message could show twice.
Call init at module load, not from a component effect. It is asynchronous, because it fetches your account’s settings, and every network-facing method refuses to run until it resolves. A child component’s effect runs before its parent’s, so an effect-based init leaves a window in which your app is mounted and interactive while the SDK is not ready.
startInAppMessaging takes an explicit customerId if you would rather not rely on the last identified customer. Call stopInAppMessaging() on logout: it dismisses what is showing, flushes analytics, and lets go of the customer, so the next start cannot quietly resume the person who just signed out. Stored state is kept, so the same customer signing back in is not shown a once-ever message twice.

Control Display and Actions

Every hook is optional, and every one of them takes effect on the most recent startInAppMessaging call.
While your own modal, drawer, or checkout step is up, tell the SDK and it holds messages until you say the screen is yours again:

Actions

A campaign’s surface or button can dismiss, open a URL, navigate to a route, or ask for push permission. onAction sees all of them first.
React Native ships no in-app browser. Both link kinds, external: true and external: false, leave for the system browser through Linking.openURL, so the customer leaves your app and comes back to it suspended, not restarted.
If you bundle a browser, pass openUrl and decide for yourself:
Whatever you do, the SDK only ever opens http, https, mailto, and tel. A campaign carrying javascript:, file:, or your own deep-link scheme is refused and logged, so a campaign cannot launch arbitrary schemes in your app.

Observe Messages

This is a listener, not a veto. Use beforeDisplay to hold or drop a message. It fires for every listener you register, and a listener that throws is logged rather than allowed to break the display.

Events and Purchases

Nothing extra to wire. Every event you already send is also a trigger, evaluated before the request goes out, so a campaign that fires on add_to_cart needs no new code:
The properties you attach are what the campaign’s filters are matched against. String comparisons are case-insensitive, and a property the event does not carry never matches.

Language and Right-to-Left

A campaign is fetched in one language. The customer’s own preferredLanguage wins; without one, the SDK uses whatever init was given. changeLanguage replaces that default for every request from then on, and campaigns already synced keep the copy they were fetched with until the next sync.
Mirroring is your app’s business, not the SDK’s. Messages are drawn into whatever layout direction your app lays out in, so an app running under I18nManager.isRTL gets right-aligned copy, mirrored buttons, and the close glyph in the top-left corner. An app that stays left-to-right does not. The SDK never forces a direction on you.

Push Permission

React Native has no notification-permission API of its own, so a campaign that asks for one asks you. Without a requester the SDK logs and closes the message rather than pretending.

Storage

Two optional packages, both resolved at runtime. Neither is required, and the SDK takes no new runtime dependency of its own.
If your app’s own insets are the authority, pass them and they win: <GameballInAppMessages insets={useSafeAreaInsets()} />.

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 a React Native app.

Logging and Troubleshooting

Pass debug: true to init for a running commentary prefixed [GameballIAM], showing which campaign was chosen, which was passed over, and why. It is on by default in development builds.

API Reference

Types InAppMessage, MessageButton, ClickAction, MessageType, MessageLayout, MessageOrientation, SlidePosition, MessageStyle, ButtonStyle, TextAlign, BeforeDisplay, DisplayDecision, OnAction, and StartInAppMessagingOptions are exported from the package root.

Launch Checklist

1

Initialize at module load

init runs at module load and is awaited before anything else.
2

Mount the surface

<GameballInAppMessages /> is mounted once, above the navigator.
3

Start and stop messaging

startInAppMessaging is awaited after a customer is identified, and stopInAppMessaging() is called on logout.
4

Wire the hooks

onNavigate if any campaign uses a route action, requestPushPermission if any campaign asks for notifications, and setOverlayOpen bracketing your own modals and checkout steps.
5

Check storage and insets

AsyncStorage is installed unless you accept that frequency caps reset on restart, safe-area insets come from somewhere, and debug is off in release builds.

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 React Native integration before release.