Skip to main content

VAKChat ReactJS

The vakchat ReactJS npm module allows for seamless integration of a chatbot into your React application. You can easily integrate your deployed VAKFlow Chatbot into a ReactJS app using the vakchat package. This guide will walk you through the integration process.

Step 1: Install VAKChat

To start, you need to install the vakchat package:

npm install vakchat

Step 2: Import and Use VAKChat Component

After installing the package, you can integrate the VAKFlow assistant by using the VAKChat component in your React application.

Here is an example of how to implement it:

import { VAKChat } from "vakchat";
import "vakchat/dist/index.css";

function App() {
return (
<div className="App">
<VAKChat
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"
/>
</div>
);
}

export default App;

Step 3: Customizing the VAKChat Component

You can customize various properties of the VAKChat component 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

In the example above, we have set the following:

  • VAKFlowID: Your VAKFlow ID (replace Your_VAKFlow_Id with your actual VAKFlow ID).
  • btnText: "AI Assistant", which appears on the chat button.
  • btnSize: Set to "sm" for a small button size.
  • theme: Set to "dark" for the dark theme.
  • position: The chat button is positioned "absolute", bottom: "20px" and right: "20px".

Once this code is added to your React app, the chat button will appear on your screen, and users can interact with the chatbot through VAKFlow.