CoderHelm Docs
APIWebhooks

Knowledge source change

POST
/webhooks/knowledge/{token}

Tells CoderHelm that pages of a connected knowledge source changed, so it syncs that source now instead of at its next scheduled sync. Sanity posts to the address shown for each Sanity source (CoderHelm registers it itself when the token may manage webhooks), signed with sanity-webhook-signature: t=<ms>,v1= and the base64url HMAC-SHA256 of <t>.<body>, keyed with the token in the address; a signature older than five minutes is refused. Notion posts to /webhooks/knowledge/notion for the whole install, signed with X-Notion-Signature: sha256= and the hex HMAC-SHA256 of the body, keyed with the subscription's verification token. An event only starts a sync: what changed is always read back from the provider with the source's own connection.

Authorization

headersanity-webhook-signature<token>

t=<ms>,v1= and the base64url HMAC-SHA256 of <t>.<body>, keyed with the token in the address.

Path Parameters

token*string

The source's webhook token, or notion for the install's Notion subscription.

Request Body

The provider's event.

application/json
  1. body

POST /webhooks/knowledge/:token — a provider says something changed. Sanity posts to each source's own address (the token is also its signing secret); Notion posts to /webhooks/knowledge/notion for the whole install. A verified event only starts a sync; content is always read back with the source's own connection. A provider's change event (the fields Coderhelm reads; the rest is ignored). Sanity sends the changed document's projection; Notion sends an event naming its workspace.

Example
{  "_id": "post-returns",  "_rev": "q8PZ1v3VaaO9ShV3lKgqXm",  "_type": "post"}
_id?|

Sanity: the changed document's id.

Example"post-returns"
_rev?|

Sanity: the document's new revision.

Example"q8PZ1v3VaaO9ShV3lKgqXm"
_type?|

Sanity: the changed document's type.

Example"post"
type?|

Notion: the event, such as page.content_updated.

Example"page.content_updated"
workspace_id?|

Notion: the workspace the event is about.

Example"1a2b3c4d-0000-4000-8000-5e6f7a8b9c0d"

Response Body

Accepted; a sync starts unless the source is paused.

curl -X POST 'https://api.coderhelm.com/webhooks/knowledge/string' \  -H 'Content-Type: application/json' \  -d '{  "_id": "post-returns",  "_rev": "q8PZ1v3VaaO9ShV3lKgqXm",  "_type": "post"}'
Empty
Edit on GitHub