Webhook
Webhooks enable real-time information flow between applications when specific events occur. Think of webhooks as “reverse APIs” - instead of requesting information, Quotion pushes information to you when important events happen.
This feature allows you to:
- Get notified when a note is updated/deleted
- Build custom documentation sites
- Create dynamic blogs
- Develop content-driven applications
- Implement real-time content management systems (CMS)
Setup Requirements
Prerequisites
- HTTP server supporting POST requests (HTTPS required)
- Database for note storage (recommended):
- SQL: PostgreSQL, MySQL
- NoSQL: MongoDB
- Cache: Redis
- Alternative: Memory cache or local file storage
Configuration Steps
- Access Quotion dashboard
- Navigate to site settings
- Set webhook URL and authorization header
- Save configuration
After saving, your HTTP server will receive events within 2 minutes of any site note changes.
Implementation Guide
Security Verification
Always verify webhook requests using the authorization header. Here’s a Next.js example:
import { type NextRequest } from 'next/server';
export async function POST(req: NextRequest) {
if (req.headers.get('authorization') !== 'MySecretToken') {
return Response.json({ message: 'Unauthorized' }, { status: 401 });
}
return Response.json({ message: 'Webhook received' });
}
Webhook Payload Structure
Example webhook event payload:
{
"site": {
"id": "8652bd70-b55d-43ad-99d2-422c7957d24b",
"subdomain": "emma"
},
"posts": [
{
"id": "suLA7Gc4ajawG4LLtHtSQ2",
"md": "hello world,\n* [ ] milk\n* [ ] egg\n* [ ] potato\n* [ ] carrot\n",
"title": "A new note",
"draft": false,
"featured": false,
"hidden": false,
"createdAt": "2025-03-06T07:44:44.8572",
"updatedAt": "2025-03-0608:08:05.212Z",
"type": "added"
}
]
}
Payload Properties
-
site: Identifies the event source
id
: Unique site identifiersubdomain
: Site subdomain
-
posts: Array of note events
type
: Event type (added
orremoved
)md
: Note content in markdown format- Additional metadata:
title
,draft
,featured
, etc.
FAQ
Request Timeout
Q: What’s the request timeout limit?
Quotion enforces a 15-second timeout. Process requests quickly and handle data processing asynchronously. For serverless platforms:
- Vercel: Use waitUntil
- Next.js 15: Use after API feature
Retry Policy
Q: How are failed requests handled?
- Maximum 3 retry attempts for a single request
- Email notification on 3rd failure
- Webhook disabled after continuous failures for 3 requests
Need Additional Features?
For custom requirements or additional event types: Contact Support