Install · Next.js

How to add a booking chatbot to a Next.js site

Add AskBok's AI booking chat to a Next.js app with next/script and lazyOnload in your root layout. One component, no npm package, no impact on page speed.

What you'll add · Chat button on every page

<script src="https://askbok.com/widget.js" data-widget-key="wk_…" async></script>

You'll need

  • A Next.js app (App Router or Pages Router)
Try the chat first

Quick answer

Add a next/script tag to your root layout (app/layout.tsx, or pages/_app.tsx) with src set to AskBok's widget.js, your data-widget-key and strategy="lazyOnload". Next.js loads it after the page is idle, so your Core Web Vitals stay fast and the chat appears on every route.

Step by step: AskBok on Next.js

  1. 1

    Copy your AskBok code

    In your AskBok dashboard open AI Chatbot → Install on your website and click Copy code. You'll paste it into your layout.

  2. 2

    Open your root layout

    Open app/layout.tsx (App Router) or pages/_app.tsx (Pages Router).

  3. 3

    Add the Script component

    Import Script from next/script and add the tag below inside <body>, with your own widget key.

  4. 4

    Deploy

    Deploy as usual. The chat loads after the page is interactive.

import Script from "next/script";

// inside <body> in app/layout.tsx
<Script
  src="https://askbok.com/widget.js"
  data-widget-key="wk_…your key…"
  strategy="lazyOnload"
/>

Your own code (with your key) is in AskBok → AI Chatbot → Install on your website. No website, or your plan doesn't allow code? Use your booking link.

If the chat doesn't appear

  • Only load it in production with a check such as process.env.VERCEL_ENV === "production".
  • Strict CSP? Allow askbok.com in script-src and frame-src.

AskBok on Next.js: FAQ

Is there an npm package?

+

You don't need one. The script tag is the whole integration and updates automatically.

Does it work with client-side navigation?

+

Yes. The chat is added once and stays open across route changes.

Will it hurt Lighthouse scores?

+

With strategy="lazyOnload" the script loads after the page is idle, so it doesn't block rendering.

How do I open the chat from my own button?

+

Call window.AskBok?.open() in your button's onClick handler. The loader adds window.AskBok once it has loaded.

Steps checked against Next.js docs — Script component on 14 November 2026. Menu names sometimes change — if yours look different, ask us in the chat.

What happens after you install

  • Visitors see a chat button (or the chat inside your page). The receptionist answers from your services, prices, opening hours and FAQs — it never invents prices or times.
  • When someone wants to book, it shows real free times from your availability and connected calendar, holds the slot and books it after they confirm.
  • You get the booking in your dashboard and calendar, the customer gets a confirmation email, and every conversation is saved in your inbox and leads list.
  • You can take over any chat yourself, and change the chat's colour, name and greeting any time without touching Next.js again.

Add an AI receptionist to your Next.js site

Answers questions, quotes real prices and books free times — 24/7. Set up in about 10 minutes.