Integration
Overview
The <ai12z-bot>
ChatBot Control is a web component designed to provide a conversational AI experience on your website, similar to chatbots. This feature offers users an interactive, AI-powered chatbot that can answer queries, guide users, and provide relevant information seamlessly.
Setup
To integrate the Bot Control (ChatBot):
Include the following script tag in the <head>
section of your HTML.
<script
type="module"
src="https://cdn.ai12z.net/pkg/ai12z@latest/dist/esm/library.js"
></script>
<link
rel="stylesheet"
href="https://cdn.ai12z.net/pkg/ai12z@latest/dist/library/library.css"
/>
Add the Component
You can insert the <ai12z-bot>
tag anywhere in the body of the HTML to display the ChatBot. It is customizable from the agent->controls->ai12z-bot
Default Template
<ai12z-bot data-key="<API_KEY>"></ai12z-bot>
Example HTML Page
<html>
<head>
<script
type="module"
src="https://cdn.ai12z.net/pkg/ai12z@latest/dist/esm/library.js"
></script>
<link
rel="stylesheet"
href="https://cdn.ai12z.net/pkg/ai12z@latest/dist/library/library.css"
/>
</head>
<body>
<div>
<ai12z-bot data-key="your_api_key_here"></ai12z-bot>
</div>
</body>
</html>
data-key
Locate the data-key in agent->agent settings
, It's the API key
Add config-id, if you have more than one config for ai12z-bot
, under agent->controls->ai12z-bot. You can have more than one config, if no config-id it picks the default config
Control Attributes
Property | Description | Example | Default |
---|---|---|---|
data-key (Required) | API key from your ai12z Agent settings | data-key="Add your Key here" | |
config-id (Optional) | Configure the particular bot otherwise the default bot config will load | config-id="123455" |
Custom bot (Optional)
If bot tag exists the standard bot control will be replaced with the html in the bot tag
<ai12z-bot data-key="your_api_key_here">
<div slot="bot">
<img
style="width: 20px; cursor: pointer"
src="https://cdn.ai12z.net/assets/web/magnifying-glass-solid.svg"
alt="chat"
/>
</div>
</ai12z-bot>
Custom Launch Template
<ai12z-bot data-key="<API_KEY>">
<div slot="bot"><button>Open Bot</button></div>
</ai12z-bot>
In the example above, we are using a simple button to open the bot instead of using the search bar or default button.
Passing attributes and tags
Attributes
Developer can pass a dictionary of additional data that can be used in prompts if you include the attribute tag in Answer AI.