Skip to content

Web inbox widget

Web Message Inbox being integrated into your website increases conversions drastically. A ready-to-use Web Inbox Widget is out of the box subscribed to all methods needed to communicate with users. Just integrate the widget into your website and customize its appearance to fit your brand.

Setting inboxWidget.enable: true registers a visitor’s device for Inbox delivery even when the visitor hasn’t granted push notification permission, so it can reach visitors who never subscribed to push.

Prerequisites

Anchor link to

To integrate Message Inbox for websites, please follow the guide.

Integrating widget

Anchor link to

When initializing Pushwoosh WebSDK, add the inboxWidget parameter:

Example
Pushwoosh.push(['init', {
...,
inboxWidget: {
enable: true,
triggerId: 'pwInbox'
}
}]);

To render the widget, you should specify a trigger element for the widget. Any DOM-element on the page could be the trigger. Specify its ID as “pwInbox” or assign any custom ID to the triggerId parameter when initializing SDK.
When WebSDK is initialized, the unread messages badge displays on the trigger element. Once the trigger element is tapped, the widget appears on the page.

Positioning

Anchor link to

By default, the widget is located in the opposite direction from the screen border closest to the trigger element.
You can set the widget’s position through configuration params:

Example
Pushwoosh.push(['init', {
...,
inboxWidget: {
enable: true,
triggerId: 'pwInbox',
position: 'top'
}
}]);

By default, the inboxWidget should be placed before the closing </body> tag.
Render the widget anywhere on the page as shown in the example below:

Example
Pushwoosh.push(['init', {
...,
inboxWidget: {
enable: true,
triggerId: 'pwInbox',
appendTo: '.widget-parent-element-class'
}
}]);

Search for a parent element is performed by querySelector, so it needs clear specification of a class, id, or element.

Customizing widget

Anchor link to

Customizing texts

Anchor link to

To customize widget text, add emptyInboxTitle and emptyInboxText parameters:

Example
Pushwoosh.push(['init', {
...,
inboxWidget: {
enable: true,
triggerId: 'pwInbox',
title: 'Inbox', // widget title
emptyInboxTitle: 'You\'re all caught up', // empty inbox widget title
emptyInboxText: 'There are no new messages. Stay tuned!' // empty inbox widget text
}
}]);

The result looks like this:

Customizing appearance

Anchor link to

To customize the widget’s appearance, use the following parameters:

Example
Pushwoosh.push(['init', {
...,
inboxWidget: {
enable: true,
triggerId: 'pwInbox',
bgColor: '#ffffff', // widget background
borderColor: 'transparent', // widget border color
borderRadius: 4, // widget border radius (px)
widgetWidth: 350, // widget width (px)
zIndex: 100 // z-index
}
}]);

Unread messages count badge can be customized as follows:

Example
Pushwoosh.push(['init', {
...,
inboxWidget: {
enable: true,
triggerId: 'pwInbox',
badgeBgColor: '#ff4c00', // badge color
badgeTextColor: '#ffffff' // badge text color
}
}]);

To customize text properties, add the following code:

Example
Pushwoosh.push(['init', {
...,
inboxWidget: {
enable: true,
triggerId: 'pwInbox',
textColor: '#333333', // text color
fontFamily: 'Helvetica, Arial, sans-serif', // font
messageTitleColor: '#7a7a7a', // messages title color
timeTextColor: '#c4c4c4', // timestamp text color
emptyInboxTitleColor: '#333333', // empty inbox title color
emptyInboxTextColor: '#7a7a7a' // empty inbox text color
}
}]);

Lastly, you can specify the icon for empty inbox:

Example
Pushwoosh.push(['init', {
...,
inboxWidget: {
enable: true,
triggerId: 'pwInbox',
emptyInboxIconUrl: 'https://pushon.pushwoosh.com/images/icon-empty-inbox.png' // URL path to an icon
}
}]);

Customizing cell layouts

Anchor link to

The widget draws a message as one of four cell layouts — classic, banner, captioned, or carousel — the same layouts the campaign preview in the control panel shows. A layout that can’t render with what the message carries degrades to classic: banner needs a hero image, captioned needs a hero image plus both a title and a body, and carousel needs at least one slide plus both a title and a body.

To customize the layouts’ appearance, use the following parameters:

Example
Pushwoosh.push(['init', {
...,
inboxWidget: {
enable: true,
triggerId: 'pwInbox',
unreadDotColor: '#ff4c00', // unread dot on the classic avatar
avatarBgColor: '#e6e6e6', // classic avatar background
avatarTextColor: '#333333', // classic avatar initial color
avatarSize: 52, // classic avatar size (px)
mediaRadius: 8, // corner radius of banner/captioned/carousel media (px)
slideCaptionColor: '#ffffff', // carousel slide caption text color
slideScrimColor: '#000000', // carousel slide caption background scrim
pagerDotActiveColor: '#ff4c00', // carousel active page dot
pagerDotColor: '#c4c4c4' // carousel inactive page dots
}
}]);

Managing it in the Control Panel

Anchor link to

To set up the widget from the Control Panel:

  1. Go to Settings → Configure platforms → Web.

  2. On the Inbox widget card, click Configure.

    Inbox widget card on the Web platform settings page with the ON badge, the Configure button, and the Return to snippet button
  3. Turn on Show the inbox on the site.

  4. Fill in the fields you want to manage from the panel, and leave the rest empty. An empty field isn’t saved, so the snippet’s value, or the SDK default, still applies. Leave ID of the element that opens the inbox and Insert into (CSS selector) empty to keep triggerId and appendTo in the snippet next to the markup they point to.

  5. Check the result in the preview. Switch between With messages and No messages to see both states.

    Inbox widget form with the Show the inbox on the site switch on, Placement, Texts, and Appearance fields, and a preview of two sample messages
  6. Save the form. Width, px takes a whole number from 200 to 1200, and Corner radius, px from 0 to 64. Any other value shows an error under the field and isn’t saved.

How the card works with the snippet

Anchor link to

Values saved in the card override the same inboxWidget keys in the init snippet, key by key. Each field sets one key:

SectionFieldinboxWidget key
PlacementID of the element that opens the inboxtriggerId
PlacementOpensposition
PlacementInsert into (CSS selector)appendTo
TextsWidget titletitle
TextsTitle when there are no messagesemptyInboxTitle
TextsText when there are no messagesemptyInboxText
TextsImage when there are no messages (URL)emptyInboxIconUrl
AppearanceWidth, px (200–1200)widgetWidth
AppearanceCorner radius, px (0–64)borderRadius
AppearanceFontfontFamily
AppearanceBackground, Text, BorderbgColor, textColor, borderColor
AppearanceCounter background, Counter text, Unread markbadgeBgColor, badgeTextColor, unreadDotColor

Keys the card doesn’t have, such as the cell layout parameters and legacyClassicCell, are always read from the snippet.

The Show the inbox on the site switch works the same way. Until it’s saved in the panel, the card’s badge reads Set in the snippet, and the snippet’s enable decides whether the widget shows. Once you save the switch, the badge reads On or Off, and the card overrides the snippet:

  • Off hides the widget even if the snippet sets enable: true.
  • On shows the widget even if the snippet has no inboxWidget at all. Like enable: true, it registers visitors for Inbox delivery without push permission.

Saved changes reach the site within a minute, on the next page load.

To hand the widget back to the snippet, click Return to snippet on the card and confirm. The button appears once anything is saved in the card. It deletes every inbox setting saved in the panel, and the site uses the inboxWidget settings of its snippet again.

To open or close the widget, use the following API method:

Example
Pushwoosh.pwinboxWidget.toggle(open?: boolean);

Opening the widget refreshes it from the server, at most once every 30 seconds — a standalone App Inbox message rides a channel with no push, so nothing else announces one between page loads.