AI form

The AI Form SDK makes it easy to embed your AI form into your application. It offers powerful features to customize the look and feel, ensuring the form blends seamlessly with your app.

Installation

The AI form is already included with the chathive SDK. If you haven't installed it into your application, first follow the SDK installation guide.

Setup

To setup the AI form, call the constructor to initialise your AI form. There are many options you can pass to the constructor. See the configuration documentation for more details.

const aiForm = new Chathive.AIForm({ apiKey: "YOUR_API_KEY" });

Good to know: For single-page apps, ensure this is executed after the SDK has fully loaded.

After initializing your AI form, you can embed it into your application. Ensure this is done after the selector element has rendered. The selector is a required parameter and uses document.querySelector to locate the HTML tag where you want to embed the form.

aiForm.embed({ selector: "#embed" })
    .then(() => console.log("AI form is embedded"));

Last updated