Add AI Chatbot to React
Give visitors to your React site an AI chatbot trained on your product and help content.
1. Create your chatbot
Create a Chatbit account, add your website or documents as sources, and test a few questions. Set the welcome message, colors and instructions to match your business. See how to add sources.
2. Copy your embed code
Open your chatbot's Share panel and copy the complete Script snippet. Keep both the configuration and the external script together. See the website setup guide.
3. Add the code to React
For a React app with an HTML entry file, place the full Chatbit snippet before its closing body tag. Keep it outside the React root so it loads once for the application.
Platform reference: React documentation.
If a framework owns your document, use its script-loading mechanism instead. Avoid inserting the snippet in a component that remounts on every route change.
4. Test the published site
Open the bot, navigate through your client-side routes, then ask a follow-up. Confirm that there is only one chat button.
If the button is missing, check that the code is saved on the published site, clear any page cache, and look for blocked requests in your browser. If it appears twice, remove the duplicate installation.
Keep the answers useful
Review the first conversations and update source content where answers are unclear. Include a contact route for questions your bot cannot answer. Learn how to improve responses.
Frequently asked questions
Do I need a platform-specific Chatbit plugin?
The setup above uses the script supplied in Chatbit. Your website platform may require a paid plan or a script-management plugin to allow that code.
Can I remove the chatbot later?
Yes. Remove the snippet from the location where you installed it, publish the change, and clear any page cache. Keep a copy of the code if you plan to add it again.