> ## Documentation Index
> Fetch the complete documentation index at: https://docs.median.co/llms.txt
> Use this file to discover all available pages before exploring further.

# In-app messages

> Show OneSignal in-app messages in your app and control triggers, pausing, and click handling with the JavaScript Bridge.

In-app messages (IAM) are rich, customizable UI panels that appear inside your app without requiring push notification permission. They're ideal for onboarding flows, feature announcements, promotions, and the iOS soft prompt pattern covered in [Managing permissions & consent](https://docs.median.co/docs/user-consent-management.md).

Unlike push notifications, in-app messages only display while the user is actively using your app. You control when they appear with a trigger system and **design them with OneSignal's HTML Composer**.

> [!NOTE]
>
> **Official documentation**
>
> For comprehensive use cases and configuration details, refer to the [OneSignal In-App Messages documentation](https://documentation.onesignal.com/docs/in-app-messages).

## JavaScript Bridge API reference

Median exposes OneSignal's IAM SDK methods through the JavaScript Bridge. Use these to control when messages appear and handle user interactions.

### Trigger management

Triggers are conditions you set in your app that cause an in-app message to display. When you add a trigger that matches the conditions set up in OneSignal's dashboard, the message appears.

Median JavaScript Bridge

```javascript JavaScript theme={null}
// Add a single trigger
median.onesignal.iam.addTrigger({ key: "value" });

// Add multiple triggers at once
median.onesignal.iam.addTriggers({ key1: "value1", key2: "value2" });

// Remove a trigger by key
median.onesignal.iam.removeTriggerForKey("key");

// Retrieve the current value of a trigger
median.onesignal.iam.getTriggerValueForKey("key");
```

### Pause and resume

Temporarily suppress in-app messages. This is useful during checkout flows, video playback, or any experience where an interruption would hurt:

Median JavaScript Bridge

```javascript JavaScript theme={null}
// Stop showing in-app messages
median.onesignal.iam.pauseInAppMessages();

// Resume showing in-app messages
median.onesignal.iam.resumeInAppMessages();
```

### Click handler

Define a JavaScript function to run when a user clicks an action button inside an in-app message:

Median JavaScript Bridge

```javascript JavaScript theme={null}
median.onesignal.iam.setInAppMessageClickHandler("yourHandlerFunctionName");
```

Your handler is called with click event data. Use it to handle the iOS soft prompt pattern (see [Managing permissions & consent](https://docs.median.co/docs/user-consent-management.md)), navigate to a page, or execute any in-app logic.

## Building your first in-app message

The following diagram shows how your app, the OneSignal SDK, and the dashboard work together to display and handle in-app messages.

```mermaid theme={null}
%%{init: {'flowchart': {'defaultRenderer': 'elk'}}}%%
sequenceDiagram
    participant Web as Your web app
    participant Bridge as JavaScript Bridge
    participant SDK as OneSignal SDK
    participant Dash as OneSignal dashboard

    Dash->>SDK: Message config with trigger rules
    Web->>Bridge: addTrigger({ key: "value" })
    Bridge->>SDK: Set trigger
    SDK->>SDK: Trigger matches dashboard rule?
    SDK->>Web: Display in-app message
    Web->>Web: User clicks action button
    Web->>Bridge: Click handler fires
    Bridge->>SDK: Report interaction
```

In-app messages are designed and configured entirely in the OneSignal dashboard using the **HTML Composer**. You control the layout, copy, buttons, and behavior. The JavaScript Bridge methods above let you control the trigger conditions and interactions from your app.

### Fire triggers from your app

When the conditions for your message are met, fire the corresponding trigger from your app:

Median JavaScript Bridge

```javascript JavaScript theme={null}
median.onesignal.iam.addTrigger({ key: "value" });
```

When the trigger matches what's configured in the OneSignal dashboard, the message displays automatically.

### Templates in the OneSignal dashboard

OneSignal provides **quickstart designs** you can choose when creating an in-app message (**Messages → In-App → New In-App**), plus **copy-paste HTML templates** for the HTML Composer, such as surveys, promos, and onboarding-style layouts. Use their guides to pick a starting point, customize copy and styling, and follow HTML Composer rules (Liquid, click tracking, safe areas):

* [In-app message templates & quickstarts](https://documentation.onesignal.com/docs/in-app-html-templates)
* [Design in-app messages with HTML](https://documentation.onesignal.com/docs/design-your-in-app-message-with-html)

Median documents the **JavaScript Bridge** (triggers and click handlers above); message HTML comes from OneSignal's composer and template library.

## Testing in-app messages

Android testing requires a **physical device**. In-app messages can't be tested on Android emulators. iOS testing works on both physical devices and the iOS simulator.

**On device or simulator:**

1. Launch the app.
2. Either wait 3+ seconds (if your message is configured with a time-based trigger), or fire the trigger manually using the JavaScript Bridge.
3. The message should appear.

### Live demo

### Demo recording

![Screen recording of a OneSignal in-app message appearing in an iOS app](https://mintcdn.com/median-co/TpSItjrYpkPK-i0N/images/docs/965b655add19568c5099e3d8addb95693b6acda7fb9f33919995dbded15c2b9c-SimulatorScreenRecording-iPhone17ProMax-2026-05-15at16.20.26-ezgif.com-video-to-gif-converter.gif?s=032bdcf935767276dbdea5a32a98d1de)

In-app message


## Related topics

- [App architecture](https://docs.median.co/docs/architecture.md)
- [App marketing and growth](https://docs.median.co/docs/app-marketing-growth.md)
- [OneSignal overview](https://docs.median.co/docs/onesignal.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.