Webhook
Webhooks enable real-time information flow between applications when specific events occur. Think of webhooks as 'reverse APIs'—instead of your application requesting information from Quotion, Quotion pushes information to your application 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)
Event Types
Currently, Quotion supports the following webhook events:
noteCreations
noteDeletions
subscriberCreations
subscriberCancellations
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
- Select the events you want to receive
- Set the Webhook URL and Authorization Header
- Save configuration
After saving, your HTTP server will receive events within 2 minutes of any relevant event occurring.
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
Note example 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",
"tags": "Code,Test",
"draft": false,
"featured": false,
"hidden": false,
"createdAt": "2025-03-06T07:44:44.8572",
"updatedAt": "2025-03-0608:08:05.212Z",
"type": "added"
}
]
}
Newsletter example payload:
{
"site": {
"id": "8652bd70-b55d-43ad-99d2-422c7957d24b",
"subdomain": "emma"
},
"newsletters": [
{
"type": "subscriberCancellations",
"subscriberId": "97af9d1e-9ac1-4e8b-8078-093f52ff3d8c",
"subscriberEmail": "hello@example.com"
}
]
}
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 formattags
: Note tags, separated by commas- Additional metadata:
title
,draft
,featured
, etc.
-
newsletters: Array of newsletter events
type
: Event type (subscriberCreations
orsubscriberCancellations
)subscriberId
: Unique subscriber identifiersubscriberEmail
: Subscriber email address
FAQs
Need Additional Features?
For custom requirements or additional event types: Contact Support
How is this guide?