Embed the Chat Widget
Drop the @bytechef/chat React widget into your own app and point it at a chat-enabled workflow.
A chat-enabled workflow in Embedded Chat mode needs your own UI. The @bytechef/chat React package provides a chat widget that calls the New Chat Request webhook and renders the replies, including streamed replies, questions, and approval requests.
Install
npm install @bytechef/chatAdd the widget
Set webhookUrl to your workflow's chat webhook URL. Append /sse to receive streamed replies:
import {AutomationChat} from '@bytechef/chat';
export function SupportChat() {
return (
<AutomationChat
config={{
description: 'Ask anything about your account.',
suggestions: [
{label: 'Track an order', prompt: 'Where is my order?', title: 'Where is my order?'},
{label: 'Manage billing', prompt: 'Cancel my subscription', title: 'Cancel my subscription'},
],
title: 'Support Assistant',
webhookUrl: 'https://<your-host>/webhooks/<webhook-id>/sse',
}}
/>
);
}Components
| Export | Description |
|---|---|
AutomationChat | The full chat surface, rendered inline in your page. |
AutomationChatModal | A floating launcher button that opens the chat in a modal. The position prop accepts bottom-right (default), bottom-left, top-right, or top-left. |
AutomationChatProvider | The context provider used by both components. Use it with the exported Thread component and useSSE hook to build a custom layout. |
Configuration
Pass the configuration as the config prop.
| Option | Type | Default | Description |
|---|---|---|---|
webhookUrl | string | - | Required. The workflow's webhook URL. When it ends with /sse, replies are streamed. |
title | string | Hello there! (Chat in the modal) | Welcome message title. In AutomationChatModal, the modal title. |
description | string | How can I help you today? | Welcome message description. In AutomationChatModal, the modal's accessible description. |
suggestions | {title, label, prompt}[] | - | Suggested prompts shown on the welcome screen. |
The widget sends message, conversationId, and attachments to the webhook as multipart/form-data and renders the reply.
Related
How is this guide?
Last updated on