Skip to content

Install — React

On React, wrap the iframe embed in a component. No package to install — it’s the same embed.widget-chat.com iframe.

import React from 'react';
// `userIdSignature` is the hex HMAC-SHA256 of `userId` keyed by your
// project's identity_secret. Compute it on YOUR backend and pass it in
// as a prop — never bake the secret into the client.
function ChatWidget({ userId, userIdSignature }) {
const embedUrl =
`https://embed.widget-chat.com?projectSecretKey=YOUR_PROJECT_SECRET_KEY` +
`&userId=${encodeURIComponent(userId)}` +
`&userIdSignature=${userIdSignature}`;
return (
<iframe
src={embedUrl}
style={{
position: 'fixed',
bottom: 0,
right: 0,
width: '400px',
height: '600px',
border: 'none',
zIndex: 9999,
}}
allow="clipboard-write"
/>
);
}
export default ChatWidget;