In-App Messaging

Prev Next

Introduction

The plugin supports triggered in-app messages on both platforms, and a persistent inbox with rich message support on iOS. Message state management (read, unread, deleted) is available on iOS only.

Triggering In-App Messages

Trigger an in-app message by event name. The SDK displays the configured message if one exists for that event in Mapp Engage.

Mapp.triggerInApp('your-event-name');

Inbox Messages (iOS)

Fetch Messages

Results are delivered asynchronously via the inbox listener.

await Mapp.fetchInboxMessage();

Subscribe to Inbox Updates

const sub = Mapp.addInboxMessagesListener((messages) => {
  console.log('Inbox messages:', messages);
});

sub.remove();

To receive individual message events:

const sub = Mapp.addInboxMessageListener((message) => {
  console.log('Inbox message:', message);
});

sub.remove();

Message State

Update the state of an inbox message. On Android (SDK v7), these methods have no effect.

Mapp.inAppMarkAsRead(templateId, eventId);
Mapp.inAppMarkAsUnRead(templateId, eventId);
Mapp.inAppMarkAsDeleted(templateId, eventId);
  • templateId (number): Template ID of the message.

  • eventId (string): Event ID of the message.

Rich Messages (iOS)

Subscribe to rich push message content.

const sub = Mapp.addRichMessagesListener((richMessage) => {
  console.log('Rich message:', richMessage);
});

sub.remove();

SDK Init Event (iOS)

Fires when iOS SDK initialization completes. Use this to delay actions that depend on the SDK being fully ready.

const sub = Mapp.addInitListener((event) => {
  console.log('SDK ready:', event);
});

sub.remove();