React/Next.js Integration
Integrate the Helper Chat Widget with React or Next.js applications
The @helperai/react
package provides first-class support for integrating the Helper Chat Widget into your React or Next.js applications. This integration offers a more seamless developer experience with TypeScript support and React hooks.
Get Started
Customize the Widget
Customize the widget by adding props to the HelperProvider
:
The HelperProvider
accepts the following props:
Prop | Type | Required | Description |
---|---|---|---|
mailbox | string | Yes | Your mailbox slug |
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 |
Add Contextual Help Buttons
Use the useHelper
hook to add contextual help buttons:
Authenticate Your Users
Add Environment Variables
Add your Helper authentication credentials to your environment variables:
For local development, add these to your environment file (e.g., .env.local
), and for production, add them to your deployment environment.
Set Up Authentication
Call generateHelperAuth
in your root layout and pass the result to the HelperProvider
:
The generateHelperAuth
function accepts the following metadata options:
Option | Type | Description |
---|---|---|
value | number | Revenue value of the customer |
name | string | Name of the customer |
links | object | Key-value pairs of links related to 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