Getting Started
From zero to agent in 5 minutes.
No backend changes required for basic setup. Paste two lines and you're live.
01
Create a product
Sign up at dashboard.widgent.app, create a product, and add your LLM API key. You'll get a Product ID.
02
Add the script tag
html
<script src="https://cdn.widgent.app/index.global.js"></script> 03
Initialize the widget
js
window.widgent.init({
productId: 'YOUR_PRODUCT_ID',
serviceKey: 'YOUR_SERVICE_KEY', // Dashboard > Security tab
type: 'bubble', // bubble | sidebar | popup | inline | headless
}); 04
Identify your user (optional but recommended)
Tell the agent who's talking. Your backend calls Widgent to mint a signed identity token.
js
// Server-side: call Widgent from your authenticated endpoint
const response = await fetch('https://api.widgent.app/v1/auth/user-token', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
productId: process.env.WIDGENT_PRODUCT_ID,
verificationSecret: process.env.WIDGENT_VERIFICATION_SECRET,
userId: user.id,
name: user.name,
}),
});
const { token } = await response.json();
// Client-side - after widgent:ready
window.widgent('setIdentityTokenFetcher', async () => {
const res = await fetch('/api/widgent-token');
const { token } = await res.json();
return token;
}); 05
Register tools (optional)
Give the agent the ability to take real actions in your app.
js
window.widgent('registerTools', {
navigateTo: async ({ path }) => {
router.push(path);
return { status: 'ok', path };
},
getOrderStatus: async ({ orderId }) => {
const res = await fetch(`/api/orders/${orderId}`);
return res.json();
},
});