Framework
Add AnTalkChat to React and Next.js
Load the widget script once in your app's layout. The window.Assistant API lets your own buttons open the chat or ask a question.
Step by step
-
1
Next.js: use next/script
Add the script to your root layout (app/layout.tsx) with the afterInteractive strategy, as below.
-
2
React (Vite or similar)
Paste the plain script tag before </body> in index.html.
-
3
Open it from your UI
Call window.Assistant.open() from a "Chat with us" button, or window.Assistant.send('…') to ask a question for the visitor.
Your snippet
TSX
import Script from 'next/script';
export default function RootLayout({ children }) {
return (
<html lang="en">
<body>
{children}
<Script
src="https://antalkchat.com/widget/v1.js"
data-assistant="ast_pub_YOUR_ID"
strategy="afterInteractive"
/>
</body>
</html>
);
}
Good to know
- Load the script once, not in every component: the widget keeps its own state.
- Events: ready, open, close, message, error — listen with window.Assistant.on('message', …).
Other integrations
HTML website
Any website
Paste one script tag before the closing body tag.
WordPress
Website builder
Add the snippet with a footer-code plugin or in your theme.
Shopify
E-commerce
Paste the snippet into your theme's layout file.
Wix
Website builder
Add the snippet as custom code on all pages.
Webflow
Website builder
Paste the snippet into your project's footer code.
REST API
API
Ask your assistant from your own server, app or CRM.
Give your website an assistant that knows your business
Add your web pages and notes, paste one line on your site, and let visitors get answers and book appointments any time of day.
Free for 30 days · No credit card required · Live in minutes