Next.js
Integration Tutorial: Adding Interworky AI Agent to Your Next.js Website



Last updated

Integration Tutorial: Adding Interworky AI Agent to Your Next.js Website



Last updated
// components/Interworky.tsx
'use client';
import Script from 'next/script';
import { FC } from 'react';
const Interworky: FC = () => {
const apiKey = "YOUR_API_KEY_HERE";
return (
<Script
src="https://storage.googleapis.com/multisync/interworky/production/interworky.js"
data-api-key={apiKey}
strategy="lazyOnload"
onLoad={async()=>{
window?.Interworky.init();
}}
/>
);
};
export default Interworky;// components/Interworky.js
'use client';
import Script from 'next/script';
const Interworky = () => (
<Script
src="https://storage.googleapis.com/multisync/interworky/production/interworky.js"
data-api-key="YOUR_API_KEY_HERE" // Replace with your API key
strategy="lazyOnload" // Loads the script after the main content
onLoad={() => { window.Interworky.init(); }} // Initialize Interworky on load
/>
);
export default Interworky;export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
<Interworky />
{children}
</body>
</html>
);
}<Interworky />