Skip to main content

Vanilla JS Integration

After creating chatbot, you can integrate the chatbot into your web application using Vanilla JavaScript. This guide provides the steps to integrate your chatbot with different themes.

Integration Options

<div style="position:fixed; bottom:40px; right:40px;" id="vakchat"></div>
<script src="https://cdn.vakx.io/vakchat/vanilla-v3.1.12.js"></script>
<script>
window.initVAKChat({
VAKFlowID: "Your_VAKFlow_ID",
btnText: "AI Assistant",
theme: "light",
shade: "rose",
introMessage: "Hello, I'm your AI assistant, here to help! How can I assist you today?",
defaultPopupSize: "small"
})
</script>

Make sure to replace the VAKFlowID with your unique flow ID, which you can find in your My Chatbots section.

Customizing the Component

You can customize various properties of the VAKChat to suit your application’s needs:

ParameterDescriptionExample ValuesDefault Value
VAKFlowIDUnique ID of your deployed VAKFlowYour_VAKFlow_IDnull
sessionIDSession ID for tracking conversationsunique_session_idnull
localStorageEnable/disable local storage for session datatrue, falsetrue
defaultPopupVisibleShow/hide chat window by defaulttrue, falsefalse
defaultPopupSizeSize of the chat popup window"small", "medium", "full""small"
baseFontSizeBase font size for the chat window"18px", "20px""16px"
btnTextText that appears on the button"AI Assistant""AI Assistant"
btnTextColorText color of the chat button#ffffff, #000000#ffffff
btnWidthWidth of the chat button"auto", "100px""auto"
btnTypeType of chat button"plainbutton", "searchbar", "gradientbutton""gradientbutton"
btnSizeSize of the chat button"xs", "sm", "md", "lg", "xl", "xxl""md"
contentWidthWidth of the chat content area"xs", "sm", "md", "lg", "xl", "xxl""lg"
positionPosition of the button in your layout"relative", "fixed""relative"
topPosition button from top of screen"20px", "auto""auto"
rightPosition button from right of screen"20px", "auto""auto"
bottomPosition button from bottom of screen"20px", "auto""auto"
leftPosition button from left of screen"20px", "auto""auto"
shadeColor scheme of the chat button and popup"zinc", "slate", "amber", "lime", "emerald", "teal", "sky", "indigo", "fuchsia", "rose""indigo"
characterLimitMaximum characters allowed in user input300, 500300
introMessageInitial message displayed in chat window"Hello, how can I help?""Hello, I'm your AI assistant, here to help! How can I assist you today?"
callToActionCustom call-to-action message displayed in the chat window"Get in Touch", "Buy Now", "Order Now"null
themeTheme of the chat window"light", "dark""light"
emailRequiredRequire email input from the usertrue, falsetrue

Example Usage

These integration scripts can be easily embedded in your HTML files. Once added, the chat button will appear in your web app, and users can interact with your AI assistant through the VAKFlow.

Key Points:

  • VAKFlowID: This is the unique ID of your deployed VAKFlow.
  • VAKBtnTxt: You can customize the button text that triggers the AI assistant (e.g., "Ask AI", "Chat with us").
  • Theme Options: Choose between light and dark themes using the appropriate script.
  • By embedding these scripts, you can quickly integrate your AI assistant into your application, enhancing user interaction through seamless AI-powered assistance.