Skip to main content
Version: 1.5.x

Browser Javascript In-App Inbox UI Components

If you're using Vanilla JS or any other libraries, you can use the Engagespot browser Javascript library to add a notification UI kit.

info

If you're using React, please use Engagespot React Component instead.

1. Importing the library

You can add Engagespot to your Javascript app from our CDN or by importing our npm package.

npm install @engagespot/client

Install from CDN

If you want to install the CDN hosted version of the library, you can paste this code in the <head> section of your app

<script
type="text/javascript"
src="https://cdn.engagespot.com/in-app-inbox-v1.x.min.js"
></script>

2. Rendering the Inbox component

Now, render the Notification Inbox inside any HTML element in your app. In this example, we will render the bell icon to a bellIcon element which I've created in my app.

<body>
<div id="bellIcon">
<!-- This is where we will render our Notification Inbox component -->
</div>
<script>
Engagespot.render('#bellIcon', {
apiKey: 'ENGAGESPOT_API_KEY',
userId: 'unique-user-id',
dataRegion: 'us', //us or eu based on your workspace data region
});
</script>
</body>

The render() method.

render() method requires two parameters. First one is the element selector string, used to select the element where the bell icon should be inserted (Eg: #bellIcon).

The second parameter is the options object, where apiKey and userId is mandatory. You'll get the apiKey from Engagespot Console. If you haven't read about Users, read this guide first.

caution

Make sure to call the Engagespot.render() method after your HTML body has loaded. Function will throw error otherwise since it tries to inject the Inbox component to the target element that you mention as the argument to Engagespot.render('#targetElementId, options)