Next.js
Use Scoopika with Next.js
This guide walks you through integrating Scoopika into your Next.js application, enabling you to leverage intelligent agents within your web components.
Prerequisites:
- A Next.js project
- A Scoopika account and access token
Initialize
Create a file named scoopika.ts
inside your lib
directory
(or adjust the path based on your project structure).
This file will house the Scoopika initialization code.
Add API Route
Next, add an API route to your Next.js project that handles everything related to Scoopika.
If using the Pages API, put the route under pages/api/scoopika.ts
.
If using the App Router, place it under app/api/scoopika/route.ts
. Here are examples for both setups:
Use Scoopika
You can now use the Scoopika client library to run Scoopika in your Next.js application. This works in both server and client components.
Scoopika React library
We provide @scoopika/react for easily building interactive AI-powered UI interfaces for both text-based and voice-based interactions with AI agents.
It provides building blocks along with built-in state management and hooks.
Check the full docs for React here.
Was this page helpful?