Easily integrate our AI agents into your web applications with our customizable web component.
You can add an AI agent anywhere on your website for any dataset using the following code. You can find a list of supported locales here.
<script src="https://bellatunes.ai/component/bella-ai.js"></script>
<bella-ai
clientId="CLIENT_ID"
clientPublicKey="CLIENT_PUBLIC_KEY"
dataSetId="DATASET_ID"
userId="CLIENT_USER_ID"
locale="en_US"
metadataItem="some value"
customInternalId="my-custom-ID-here">
</bella-ai>
Here's an overview of what each input for the web component does:
Input | Required? | Description |
---|---|---|
clientId | ✅ | Your Bella client ID |
clientPublicKey | ✅ | Your Bella client public key |
dataSetId | ✅ | The dataset that will dictate the chat |
userId | ❌ | If you've added this user into Bella (this can be done from the dashboard or the API), you can input the Bella client user ID (not your system's user ID) here to add personalization |
locale | ❌ | The locale you want to use for this chat. Defaults to en_US. Please see the list of supported locales for options. |
metadataItem customInternalId _etc. | ❌ | Bella allows you to pass as many custom metadata items as you want. This data is then passed with the chat message to your AI agent who can use it for various purposes, such as forwarding it via an API module request and using it to augment the AI agent's context. This data can also be used by some modules to add data within the chat that isn't directly collected from the user. Note that you should NOT preface these with an underscore if you're using a tool like React as it will filter them out. |
Bella emits a number of events that you can capture to perform additional functionality outside of the web component.
Event | Description | Payload |
---|---|---|
bella-event-blocking-action | Emitted when a blocking action is started, such as a module run before a prompt | - |
bella-event-blocking-action-complete | Emitted when a blocking action is completed | - |
bella-event-communicating | Emitted when the component is communicating with the server | - |
bella-event-chat-msg-received | Emitted when a chat message is sent to the API for processing by AI | - |
bella-event-chat-msg-internal | Emitted when a chat message is sent internally but never reaches the API or AI | - |
bella-event-question-failed | Emitted when a question fails to process | - |
bella-event-question-processed | Emitted when a question is processed successfully | - |
bella-event-server-chat-reply | When a response is received from your AI agent. | - |
Web components use shadow DOM, therefore you can't directly control the classes within the component itself. To compensate for this, we've added a number of CSS variables that you can overwrite in your website's style sheets to adjust the layout of the AI agent chatbox.
<style>
:root {
--bella-border: 1px solid #ccc;
}
</style>
CSS Variable | Description |
---|---|
General | |
--bella-border | Defines the default border style for elements |
--bella-padding | Padding for the primary container. |
--bella-border-radius | Specifies the default border radius for rounded corners |
--bella-text-secondary-color | Sets the color for secondary text elements |
--bella-bg-color | Defines the default background color for elements |
--bella-hover-bg-color | Specifies the background color for elements when hovered |
--bella-link-color | Sets the color for hyperlinks |
ChatThe primary chatbox area. | |
--bella-chat-textarea-padding | Padding for the chat textarea |
--bella-chat-textarea-background | Background color for the textarea. |
--bella-chat-textarea-border | Border for the textarea. |
--bella-chat-textarea-border-radius | Border radius for the textarea. |
--bella-chat-textarea-margin | Margin for the chat textarea |
--bella-chat-textarea-height | Height of the chat textarea |
--bella-chat-messages-margin | Margin for the chat messages container |
--bella-chat-message-border | The border for chat messages |
--bella-chat-messages-gap | Gap between chat messages |
--bella-chat-message-user-bg | Background color for user messages |
--bella-chat-message-bella-bg | Background color for Bella's messages |
--bella-chat-actions-text-align | Text alignment for chat actions |
--bella-chat-actions-font-size | Font size for chat actions |
--bella-chat-actions-font-color | Font color for chat actions |
--bella-chat-actions-margin | Margin for chat actions |
--bella-chat-actions-text-transform | Text transform for chat actions |
--bella-chat-messages-gap | Gap between chat messages |
--bella-chat-messages-margin | Margin for chat messages |
Inline FormsStyles for various inputs and buttons. | |
--bella-form-button-padding | Padding for the form buttons |
--bella-form-label-display | Display property for form labels |
--bella-form-label-font-weight | Font weight for form labels |
--bella-form-label-margin | Margin for form labels |
--bella-form-label-font-size | Font size for form labels |
--bella-form-input-padding | Padding for form inputs |
--bella-form-input-border | Border for form inputs |
--bella-form-field-margin | Margin for form inputs |
--bella-form-field-description-padding | |
--bella-form-field-description-margin | |
--bella-form-field-description-weight | |
--bella-form-field-description-size | |
--bella-form-field-description-color | |
QuestionsThe predefined questions a user can click to interact with the chatbot. | |
--bella-questions-padding | Padding for the questions container |
--bella-questions-flex-direction | Flex direction for the questions container |
--bella-questions-font-size | Size of the text used for questions |
--bella-questions-gap | Gap between questions |
--bella-questions-margin | Margin for the questions container |
--bella-questions-text-align | Text alignment for questions |
--bella-questions-font-weight | Font weight for questions |
LinksWhen your AI agent returns relevant links, this controls the styles on those links. | |
--bella-links-padding | Padding for the links container |
--bella-links-gap | Gap between links items |
--bella-links-text-align | Text alignment for links items |
--bella-links-flex-direction | Flex direction for the links container |
--bella-links-image-size | Size of the links images |
--bella-links-title-font-weight | Font weight for links titles |
--bella-links-title-font-size | Font size for links titles |
--bella-links-details-font-size | Font size for links details |
--bella-links-title-margin | Margin for links titles |
Option Lists Options lists are used in various modules to display actions a user can take. | |
--bella-actions-container-cols | |
--bella-actions-container-gap | |
--bella-actions-container-margin | |
--bella-actions-container-padding | |
--bella-actions-button-padding | |
--bella-actions-button-border | |
--bella-actions-button-border-radius | |
--bella-actions-button-background | |
--bella-actions-button-text-color | |
--bella-actions-button-text-size | |
--bella-actions-button-text-align | |
--bella-actions-button-text-line-height | |
--bella-actions-button-width | |
--bella-actions-button-border-hover | |
--bella-actions-button-background-hover | |
--bella-actions-submit-container-gap | |
--bella-actions-submit-container-justify | |
--bella-actions-submit-container-margin | |
--bella-actions-submit-container-padding | |
Miscellaneous | |
--bella-header-subsection-font-size | Font size for subsection headers |
--bella-header-subsection-display | Display status for "followup questions" and "relevant links" headings |
--bella-header-subsection-text-align | Text alignment for subsection headers |
--bella-header-subsection-font-weight | Font weight for subsection headers |
--bella-header-subsection-padding | Padding for subsection headers |
--bella-header-subsection-text-color | Text color for subsection headers |
--bella-weak-text-weight | |
--bella-weak-text-size | |
--bella-weak-text-color |