Prerequisites
To integrate Message Inbox for websites, please follow the guide.
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.
When initializing Pushwoosh WebSDK, add the inboxWidget
parameter:
ExamplePushwoosh.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.
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:
ExamplePushwoosh.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:
ExamplePushwoosh.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.
To customize widget text, add emptyInboxTitle
and emptyInboxText
parameters:
ExamplePushwoosh.push(['init', {...,inboxWidget: {enable: true,triggerId: 'pwInbox',title: 'Inbox', // widget titleemptyInboxTitle: 'You\'re all caught up', // empty inbox widget titleemptyInboxText: 'There are no new messages. Stay tuned!' // empty inbox widget text}}]);
The result looks like this:
To customize the widget's appearance, use the following parameters:
ExamplePushwoosh.push(['init', {...,inboxWidget: {enable: true,triggerId: 'pwInbox',bgColor: '#ffffff', // widget backgroundborderColor: 'transparent', // widget border colorborderRadius: 4, // widget border radius (px)widgetWidth: 350, // widget width (px)zIndex: 100 // z-index}}]);
Unread messages count badge can be customized as follows:
ExamplePushwoosh.push(['init', {...,inboxWidget: {enable: true,triggerId: 'pwInbox',badgeBgColor: '#ff4c00', // badge colorbadgeTextColor: '#ffffff' // badge text color}}]);
To customize text properties, add the following code:
ExamplePushwoosh.push(['init', {...,inboxWidget: {enable: true,triggerId: 'pwInbox',textColor: '#333333', // text colorfontFamily: 'Helvetica, Arial, sans-serif', // fontmessageTitleColor: '#7a7a7a', // messages title colortimeTextColor: '#c4c4c4', // timestamp text coloremptyInboxTitleColor: '#333333', // empty inbox title coloremptyInboxTextColor: '#7a7a7a' // empty inbox text color}}]);
Lastly, you can specify the icon for empty inbox:
ExamplePushwoosh.push(['init', {...,inboxWidget: {enable: true,triggerId: 'pwInbox',emptyInboxIconUrl: 'https://pushon.pushwoosh.com/images/icon-empty-inbox.png' // URL path to an icon}}]);
To open or close the widget, use the following API method:
ExamplePushwoosh.pwinboxWidget.toggle(open?: boolean);