Webhooks
Webhooks allow external services to be notified when certain events happen. When the specified events happen, we’ll send a POST request to the URL you configure in your site settings.
Configure your Webhook
First, go to your site settings and add the URL where you want us to post the events. All URLs should be using HTTPS.
Receiving events
Events are sent as JSON payloads with an additional params so you don't have to parse the payload every time. The kind of events that your webhook URL will receive are:
note-updated
{"event":"note-updated","data":{"note":"<NOTE as JSON>"}}
note-created
{"event":"note-created","data":{"note":"<NOTE as JSON>"}}
note-deleted
{"event":"note-deleted","data":{"note":"<NOTE as JSON>"}}
notes-reordered
{"event":"notes-reordered","data":{"notes":["<NOTE as JSON>", ...]}}
Parsing events
We also send an extra event
param to the URL so you don't have to parse the JSON to see what kind of event you got. For example when receiving a note-updated
event the url we will call would look like this:
https://your-url/webhook?event=note-updated
.
Sample event payload
Here's a sample of what you can expect to receive as the JSON payload for a webhook event when updating a note note-updated
:
{
"event": "note-updated",
"data": {
"note": {
"id": 1,
"site_id": 1,
"user_id": 1,
"body": "# some text",
"path": "some-path",
"headline": "",
"title": "some text",
"created_at": "2020-07-07T01:34:01.156Z",
"updated_at": "2020-07-09T15:40:34.185Z",
"visibility": "private",
"poster": null,
"ordering": 0,
"url": "scheme://some-url/some-path"
}
}
}
Notice
- Webhooks are “best effort”. Don't rely on every webhook to be called for anything critical.
- There might be a bit of delay between events happening and your URL being called.
API
Check out what's possible with the REST API here