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">
{/* Replace 'Your_VAKFlow_Id' with your unique VAKFlow ID */}
<VAKChat
flowID="Your_VAKFlow_Id"
btnText="AI Assistant"
size="sm"
theme="dark"
position="fixed"
bottom="20px"
right="20px"
introMessage="Hi, Hello, I'm your AI assistant, here to help! How can I assist you today?"
/>
</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 Values
flowIDThe unique ID of your deployed VAKFlow.Your_VAKFlow_ID
btnTextThe text that will appear on the button."AI Assistant"
introMessageThe initial message displayed in the chat window."How can I help you today?"
sizeThe size of the chat button.xs, sm, md, lg, xl
themeThe theme of the chat window."light", "dark"
positionThe position of the button in your layout."relative", "fixed"
topUse to position the button from the top of the screen."20px"
bottomUse to position the button from the bottom of the screen."20px"
rightUse to position the button from the right of the screen."20px"
leftUse to position the button from the left of the screen."20px"

Example

In the example above, we have set the following:

  • flowID: Your VAKFlow ID (replace Your_VAKFlow_Id with your actual VAKFlow ID).
  • btnText: "AI Assistant", which appears on the chat button.
  • size: 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.