Skip to main content
In-app messages let you surface timely, personalized content to your users without requiring a page reload or a new deployment. You create and manage messages in the Tappd dashboard — the SDK handles fetching them, evaluating trigger conditions, rendering the UI, and tracking interactions automatically.

Configuration

Enable in-app messages when you initialize the SDK:

Configuration Options

boolean
default:"true"
Enable or disable in-app message rendering entirely.
boolean
default:"true"
When true, the SDK automatically fetches and displays pending messages for the identified user.
number
default:"30"
How often (in seconds) the SDK polls for new messages.
string
A custom DOM element ID to use as the message container. When omitted, messages are appended to document.body.

Automatic Display

When autoDisplayMessages is true, the SDK runs the full message lifecycle without any additional code from you:
1

Fetch Pending Messages

After identify() is called, the SDK fetches all messages the current user is eligible to receive.
2

Evaluate Trigger Conditions

Each message is evaluated against its configured trigger — immediate display, a time delay, a specific event, or a page visit.
3

Display Ready Messages

Messages that pass their trigger conditions are rendered in the DOM using the configured message type and content blocks.
4

Track Interactions

message.viewed, message.clicked, and message.dismissed events are tracked automatically.
5

Poll for New Messages

The SDK continues polling every messagePollingInterval seconds to pick up newly published messages.

Manual Control

If you need to manage message display yourself, set autoDisplayMessages: false and use the methods below.

Fetch Messages

Display a Specific Message

Display All Pending Messages

Dismiss a Message

Track a Message Event Manually

Message Types

The SDK renders three message types, each suited to different use cases:
Banners are fixed-position messages anchored to the top, bottom, or center of the screen. They support slide and fade animations and are ideal for announcements, promotions, and notifications.

Message Blocks

Each message is composed of one or more content blocks. You configure these in the Tappd dashboard.
Displays an image with alignment and sizing control.
Displays styled text content. The content property supports basic HTML.
A clickable button that navigates to a link or triggers an action.
Injects raw HTML content. All content is sanitized before rendering.

Event Tracking

The SDK automatically fires these events for every message interaction: All three events include the messageId property. Click events also include buttonText and buttonLink.

CSS Customization

The SDK injects default styles automatically. Override them in your own stylesheet:
Use your browser’s DevTools to inspect the injected message elements and find the exact class names you need to target.

Complete Example