const HEADERS = { "X-API-Key": "YOUR_API_KEY" };
// Render the intent table
const intents = await fetch(
"https://api.appeeky.com/v1/ai-visibility/1234567890/intents?model=chatgpt",
{ headers: HEADERS }
).then((r) => r.json());
intents.data.forEach((row) => {
console.log(`${row.label} visibility=${row.visibilityPct}% sentiment=${row.sentimentPct}%`);
});
// Add a custom intent
const created = await fetch(
"https://api.appeeky.com/v1/ai-visibility/1234567890/intents",
{
method: "POST",
headers: { ...HEADERS, "Content-Type": "application/json" },
body: JSON.stringify({
label: "Help me journal in Turkish",
description: "Turkish-speaking user wants an app to keep a daily journal.",
}),
}
).then((r) => r.json());
console.log("New intent:", created.data.id);