Install the live chat widget on Express
XACUBE puts a live chat widget on your Express site, so your live agents can answer visitors the moment they ask, from one shared inbox. The free plan covers one agent.
- Open
views/layout.ejsand paste the code just before</body>. - Publish your site. The chat appears on every page.
<script src="https://chat.xacube.chat/w.js" data-key="YOUR_PUBLIC_KEY" async></script>
Replace YOUR_PUBLIC_KEY with your own key. In your panel, open your website and this code is shown with your key already in it.
Recognise signed-in customers
// Middleware, before your routes render:
const crypto = require('node:crypto')
app.use((req, res, next) => {
if (req.user) res.locals.xacubeHash = crypto.createHmac('sha256', process.env.XACUBE_SECRET_KEY)
.update(String(req.user.id)).digest('hex')
next()
})
<!-- views/layout.ejs -->
<script src="https://chat.xacube.chat/w.js" data-key="YOUR_PUBLIC_KEY"
data-user-id="<%= user.id %>"
data-user-hash="<%= xacubeHash %>"
data-user-name="<%= user.name %>"
data-user-email="<%= user.email %>" async></script>