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.
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
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.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 recentstartInAppMessaging call.
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.
If you bundle a browser, pass openUrl and decide for yourself:
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
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 onadd_to_cart needs no new code:
Language and Right-to-Left
A campaign is fetched in one language. The customer’s ownpreferredLanguage 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.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
Passdebug: 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.Related Articles
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.