tiptap/docs/collaboration/webhook.md
Sven Adlung e567a441d5
Docs update (#4804)
* Create management-api

* Create getting-started

* Create Introduction

* Rename Introduction to Introduction.md

* Rename getting-started to getting-started.md

* Rename management-api to management-api.md

* Create webhook.md

* Create simple-collaboration-app.md

* Create jwt-authentication.md

* Delete docs/cloud directory

* Delete docs/tutorials.md

* Update links.yaml

* Update links.yaml

* Rename Introduction.md to introduction.md

* Delete docs/tutorials directory

* Update links.yaml

* Update links.yaml

---------

Co-authored-by: ThisDavidRichard <147505039+ThisDavidRichard@users.noreply.github.com>
2024-01-19 14:33:57 +01:00

24 lines
1.3 KiB
Markdown

## Webhook
You can define a URL and we will call it every time a document has changed. This is useful for getting the JSON representation of the Yjs document in your own application. We call your webhook URL when the document is saved to our database. This operation is debounced by 2-10 seconds. So your application won't be flooded by us. Right now we're only exporting the fragment `default` of the Yjs document.
You can add the webhook URL in the [settings page](https://collab.tiptap.dev/apps/settings) of your Tiptap Collab app.
### Payload
A sample payload of the webhook request looks like this:
```json
{
"appName": '', // name of your app
"name": '', // name of the document
"time": // current time as ISOString (new Date()).toISOString())
"tiptapJson": {}, // JSON output from Tiptap (see https://tiptap.dev/guide/output#option-1-json): TiptapTransformer.fromYdoc()
"ydocState"?: {}, // optionally contains the entire yDoc as base64. Contact us to enable this property!
"clientsCount": 100 // number of currently connected clients
}
```
### Signing
All requests to your webhook URL will contain a header called `X-Hocuspocus-Signature-256` that signs the entire message with your secret. You can find it in the [settings](https://collab.tiptap.dev/apps/settings) of your Tiptap Collab app.