JavaScript Integration
Integrate the Helper Chat Widget with vanilla JavaScript
If you use React, please refer to the React integration guide.
Get Started
Add the following script to your HTML, replacing the placeholder values with your mailbox slug:
This is the simplest way to add the widget to your site. The widget will appear in the bottom-right corner of your page.
Optional: Next Steps
Customize the Widget
You can customize the widget by adding a helperWidgetConfig
object above the widget script tag:
The helperWidgetConfig
object accepts the following options:
Option | Type | Required | Description |
---|---|---|---|
title | string | No | Custom title for the chat widget |
icon_color | string | No | A custom color for the widget icon |
show_toggle_button | boolean | No | Override the "Chat Icon Visibility" setting |
email | string | Yes* | Email address of the authenticated customer |
email_hash | string | Yes* | HMAC hash generated on the server |
timestamp | number | Yes* | Timestamp used in HMAC generation |
metadata.value | number | No | Revenue value of the customer |
metadata.name | string | No | Name of the customer |
metadata.links | object | No | Key-value pairs of links related to the customer |
* Required only if you want to authenticate users
Add Contextual Help Buttons
You can add context-specific help buttons using HTML data attributes:
Authenticate Your Users
To authenticate your users, you'll need to set up both backend and frontend components.
Backend Setup
First, generate an HMAC hash on your server using the HMAC secret from your Helper dashboard. Node.js example:
Frontend Setup
Add the generated HMAC hash, customer email, and timestamp to your widget config:
Optionally, you can add metadata to give Helper more context about the customer:
Security Considerations
- Never expose your HMAC secret on the client side
- Always generate the HMAC hash on your server
- Use HTTPS to prevent man-in-the-middle attacks
- Validate the timestamp on your server to prevent replay attacks