Architects
This guide covers integration patterns for Agility CMS, including frontend frameworks, third-party services, and custom integrations.
This guide covers integration patterns for Agility CMS, including frontend frameworks, third-party services, and custom integrations.
SDK: @agility/nextjs
Features:
Pattern:
import { getContentItem } from "@/lib/cms/getContentItem"
const { fields } = await getContentItem<IPost>({
contentID: 204,
languageCode: "en-us"
})
Gatsby:
Nuxt:
Eleventy:
Pattern:
Example:
GET /{instance-guid}/fetch/{locale}/list/posts?take=10&skip=0
Pattern:
Example:
query {
contentList(referenceName: "posts") {
items {
contentID
fields {
heading
slug
}
}
}
}
Pattern:
Example:
const sdk = await getAgilitySDK()
const items = await sdk.getContentList({ referenceName: "posts" })
PostHog:
Google Analytics:
Algolia:
Custom Search:
Azure OpenAI:
Custom AI:
Setup:
Event categories:
Delivery guarantees:
webhook-id header as an idempotency key⚠️ There is no webhook "security key."
AGILITY_SECURITY_KEYis the preview key and is never sent with a webhook, and custom headers cannot be configured. Secure delivery signs each request instead — Agility implements the open Standard Webhooks spec, so you verify with an off-the-shelf library. See Verifying Signed Webhooks.
import { Webhook } from 'standard-webhooks'
export async function POST(request: Request) {
// Read the RAW body - re-serializing the JSON breaks verification
const raw = await request.text()
const wh = new Webhook(process.env.AGILITY_WEBHOOK_SIGNING_SECRET!)
try {
wh.verify(raw, {
"webhook-id": request.headers.get("webhook-id")!,
"webhook-timestamp": request.headers.get("webhook-timestamp")!,
"webhook-signature": request.headers.get("webhook-signature")!,
})
} catch {
return Response.json({ error: "Invalid signature" }, { status: 401 })
}
const event = JSON.parse(raw)
// Process event (idempotently - key off the webhook-id header)
// Revalidate cache
return Response.json({ ok: true })
}
Use each webhook's History view in Settings → Webhooks to see delivery attempts, response codes and errors when debugging an integration.
Create custom API routes for:
Use middleware for: