---
updatedAt: 2026-04-08T10:24:22.000Z
---

# React Native Campaign API reference

Below are the methods that you can use to manage the Campaign library for React Native.

# Inbox notification plugin API reference

This inbox notification plugin is used to add inbox functionality to your application. The messages are created on the server and passed to the device over a periodic sync process. They are displayed via templates that provide a means to display their content in both list form and full screen. These templates are designed to be customized for your application. You can also create additional inbox templates and register them with the server so other types of messages can be displayed to the user.

## `inboxMessageCount(callback)`

Use this function to determine how many inbox messages are in the inbox and how many are unread. The counts are delivered to the callback function as an object with unread and messages keys.

```javascript Example
import { NativeModules } from 'react-native';

const { RNAcousticMobilePushInbox } = NativeModules;

RNAcousticMobilePushInbox.inboxMessageCount(function(counts) { 
	console.log("There are " + counts.messages + " messages in the inbox and " + counts.unread + " are unread");
});
```

## `deleteInboxMessage(inboxMessageId)`

This function can be used to delete the inbox message with the provided inboxMessageId value. Note that the inboxMessageId comes from an inbox message that is currently displayed.

```javascript Example
import { NativeModules } from 'react-native';

const { RNAcousticMobilePushInbox } = NativeModules;
const inboxMessageId = "abc";

RNAcousticMobilePushInbox.deleteInboxMessage(inboxMessageId);
```

## `readInboxMessage(inboxMessageId)`

This function can be used to mark an inbox message as read via the inbox message with the provided inboxMessageId value. Note that the inboxMessageId comes from an inbox message that is currently displayed.

```javascript Example
import { NativeModules } from 'react-native';

const { RNAcousticMobilePushInbox } = NativeModules;
const inboxMessageId = "abc";

RNAcousticMobilePushInbox.readInboxMessage(inboxMessageId);
```

## `syncInboxMessages()`

This function requests the SDK to sync the inbox messages with the server.

```javascript Example
import { NativeModules } from 'react-native';

const { RNAcousticMobilePushInbox } = NativeModules;

RNAcousticMobilePushInbox.syncInboxMessages();
```

## `listInboxMessages(ascending, callback)`

This function can be used to list the contents of the inbox. The ascending parameter can be true for messages sorted in ascending order of send date and false to sort the messages in descending order. The messages are provided to the callback function for processing.

```javascript Example
import { NativeModules } from 'react-native';

const { RNAcousticMobilePushInbox } = NativeModules;

RNAcousticMobilePushInbox.listInboxMessages(false, (inboxMessages) => {
	inboxMessages.forEach((inboxMessage) => {
		console.log("Inbox message found with inboxMessageId: " + inboxMessage.inboxMessageId + ", content: " + JSON.stringify(inboxMessage.content) + ", expirationDate: " + inboxMessage.expirationDate + ", sendDate: " + inboxMessage.sendDate +  ", displayed using template: " + inboxMessage.templateName + ", the message is" +  (inboxMessage.isRead ? "" : " NOT" ) + " read, the message is" + (inboxMessage.isDeleted ? "" : " NOT" ) + " deleted, and is" + (inboxMessage.isRead ? "" : " NOT" ) + " expired.");
	})
});
```

## `clickInboxAction(action, inboxMessageId)`

This function can be used to trigger an inbox message action. The action is defined in the message which is referenced by it's inboxMessageId. Note: these should both come from valid inbox messages in the inbox. See default and post inbox templates for concrete examples.

```javascript Example
import { NativeModules } from 'react-native';

const { RNAcousticMobilePushInbox } = NativeModules;
const action = {type: "url", value: "http://accoustic.co"};
const inboxMessageId = "abc";

RNAcousticMobilePushInbox.clickInboxAction(actionFromMessage, inboxMessageId);
```

## `registerInboxComponent(module)`

This function registers the root view for the inbox message push action handler. Typically this is setup in inbox-action.js and registers the InboxAction class to handle inbox push events. However, this can be customized if desired.

```javascript Example
import { NativeModules } from 'react-native';

const { RNAcousticMobilePushInbox } = NativeModules;

RNAcousticMobilePushInbox.registerInboxComponent("InboxAction");
```

## `hideInbox()`

This function hides the inbox message overlay that is popped up when an inbox message action is handled.

```javascript Example
import { NativeModules } from 'react-native';

const { RNAcousticMobilePushInbox } = NativeModules;

RNAcousticMobilePushInbox.hideInbox();
```

# In-app message plugin API reference

The in-app message plugin lets you add InApp functionality to your application. The messages are created on the server and passed to the device over a periodic synchronization process. These messages are displayed over the application content, typically as promotional messages.

The messages are displayed via templates that define how they look and if they cover the entire screen or only a part of the screen. The default templates we provide are customizable. You can also create your own InApp templates to provide for additional use cases.

## `hideInApp()`

This function hides the currently displayed InApp message.

```javascript Example
import { NativeModules } from 'react-native';
const { RNAcousticMobilePushInapp } = NativeModules;
RNAcousticMobilePushInapp.hideInApp();
```

## `createInApp(content, template, rules, maxViews, attribution, mailingId)`

Use this function to add a new InApp message to the system. Note: this is typically only done in a testing context. The content of the message is specified as a generic JavaScript object and is entirely customizable by the template. The rules is an array of keywords that define when to display the message. The `maxViews` parameter defines how many times the message should be shown to the user. Note that when the user clicks on the message, it is deleted regardless of how many views are remaining. The `attribution` parameter optionally defines where the message came from and the `mailingId` optional parameter defines what mailing the message came from.

```javascript Example
import {
    NativeModules
} from 'react-native';

const {
    RNAcousticMobilePushInapp
} = NativeModules;
const content = {
    text: "Minimal Banner Message",
    action: {
        type: "url",
        value: "http://acoustic.co"
    }
};
const template = "default";
const rules = ['product', 'home']; // Keywords of when to display this InApp message 
const maxViews = 5; // Maximum number of times a message is displayed
const attribution = "optional attribution string";
const mailingId = "optional mailing id string";

RNAcousticMobilePushInapp.createInApp(content, template, rules, maxViews, attribution, mailingId);
```

### `executeInApp(rules)`

This function executes the specified rules, which is an array of keywords. If there is a message with any of those rules in the database, that message will be displayed on the top of the current content.

```javascript Example
import {
    NativeModules
} from 'react-native';

const {
    RNAcousticMobilePushInapp
} = NativeModules;
const rules = ["product", "about"];

RNAcousticMobilePushInapp.executeInApp(rules);
```

## `registerInApp(template, module, height)`

This function registers an InApp template with the SDK. The template name must be unique across all registered templates, the module specifies what module is registered with react native and the height optionally specifies a desired height of the InApp message. Please see the included banner and media templates for concrete examples.

```javascript Example
import {
    AppRegistry,
    NativeModules
} from 'react-native';
import {
    InAppTemplate
} from './in-app-template';

const {
    RNAcousticMobilePushInapp
} = NativeModules;

export default class ExampleTemplate extends InAppTemplate {
    render() {
        return ( <
            View / >
        );
    }
}

AppRegistry.registerComponent("ExampleTemplate", () => ExampleTemplate);
RNAcousticMobilePushInapp.registerInApp("example", "ExampleTemplate", 44);
```

## `clickInApp(inAppMessageById)`

This function registers a click of an InApp message which sends an event back to the server, opens the action associated with the message and dismisses the message. The inAppMessageId comes from the current InApp message that is displayed. Please see the included banner and media templates for concrete examples.

```javascript
import {
    NativeModules
} from 'react-native';

const {
    RNAcousticMobilePushInapp
} = NativeModules;
const inAppMessageId = "ABCD";

RNAcousticMobilePushInapp.clickInApp(inAppMessageid)
```

## `syncInAppMessages()`

This function requests the SDK to sync the inbox messages with the server.

```javascript Example
import {
    NativeModules
} from 'react-native';

const {
    RNAcousticMobilePushInapp
} = NativeModules;

RNAcousticMobilePushInapp.syncInAppMessages();
```

## `deleteInApp(inAppMessageId)`

This function lets you remove an InApp message from the database. `inAppMessageId` comes from an InApp message object.

```javascript
import {
    NativeModules
} from 'react-native';

const {
    RNAcousticMobilePushInapp
} = NativeModules;
const inAppMessageId = "ABCD";

RNAcousticMobilePushInapp.deleteInApp(inAppMessageid)
```

# Related pages

* [Add notification action plugins to a React Native project](https://developer.goacoustic.com/acoustic-campaign/docs/in-app-content-plugin-for-react-native-projects)
* [All Campaign plugins for React Native projects (GitHub)](https://github.com/go-acoustic/Acoustic-Mobile-Push-React-Native/tree/master/Documentation/markdown)