AI chatbot for Next.js
Add one <Script> to your root layout and every route has an agent that answers from your own content. It loads after your page, with the App Router or the Pages Router.
- next/script in your layout
- App Router and Pages Router
- Free plan to start
Made for Next.js apps
This is for teams running a marketing site or an app on Next.js who want visitors' questions answered from their own pages, docs and files.
It's one tag in the root layout, so every route gets the chat without touching your pages. There's no package to add and nothing to build.
Install on Next.js, step by step
Create your agent first: paste your website's address and it reads your pages. Then add it to your site.
Add it to your root layout
- 1Create your agent: paste your website URL and let it read your pages.
- 2Add the <Script> below to app/layout.tsx, after {children}. With the Pages Router, add the same <Script /> to pages/_app.tsx.
- 3Deploy, or run next dev, and ask a question you know the answer to.
// app/layout.tsx (Pages Router: add the same <Script /> to pages/_app.tsx)
import Script from "next/script"
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body>
{children}
<Script
src="https://replybash.com/embed.js"
data-agent-id="YOUR_AGENT_KEY"
strategy="lazyOnload"
/>
</body>
</html>
)
}Preview deployments have their own addresses: add them in Embed › Allowed domains, where *.yourdomain.com covers every subdomain. Other ways to install, such as the chat inside one page, are in the quickstart.
What works on your site
Every feature below is built and in the product today.
Loads after your page
strategy="lazyOnload" lets your page finish loading before the chat script starts.
One place for every route
In the root layout, the chat is on every route and keeps its conversation as visitors move around.
Both routers
The App Router takes it in app/layout.tsx; the Pages Router in pages/_app.tsx.
Local and preview testing
It loads on localhost by default, and on preview addresses once you add them to Allowed domains.
Only where you want it
Page rules show it on some paths only, or call replybash("hide") from a client component.
Answers with sources
Every answer comes from your pages and files, and website answers show the page they used.
Your website
Put your website to work tonight
Paste your URL and chat with your agent in minutes.
Free for 100 messages a month · No credit card required