Next.js (Pages Router)
For projects using the older Pages Router (pages/ directory), the chat script goes in pages/_app.tsx. The floating launcher appears on every page — no container element needed.
Install#
No package install needed. Copy the snippet from the Connect tab in your dashboard and replace YOUR_PROJECT_ID with your project's ID.
Add the script#
In pages/_app.tsx, use Next's <Script> component:
Verify#
Run npm run dev and the chat bubble appears on every page. Send a test message and confirm it lands in your connected Telegram. Make sure chat is enabled and your Telegram is connected in the dashboard first.
Because afterInteractive defers the script, window.eloqra doesn't exist during your first render. If a component opens the chat, call it optionally — window.eloqra?.('open') — or add the queue stub described in Control it from JavaScript, which buffers commands until the widget is ready.
