diff options
| author | 玄猫 <hanguofeng@gmail.com> | 2025-01-19 20:34:42 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-19 12:34:42 +0000 |
| commit | b9cce5d12baa40deb21ab4f36be19e3a41e18ad4 (patch) | |
| tree | f4ec46c026c35ec2c70393b92f52b87e468746ef /docs | |
| parent | b323573047dee4c358f513fbb9b50174e9e98a99 (diff) | |
| download | karakeep-b9cce5d12baa40deb21ab4f36be19e3a41e18ad4.tar.zst | |
feat(webhook): Implement webhook functionality for bookmark events (#852)
* feat(webhook): Implement webhook functionality for bookmark events
- Added WebhookWorker to handle webhook requests.
- Integrated webhook triggering in crawlerWorker after video processing.
- Updated main worker initialization to include WebhookWorker.
- Enhanced configuration to support webhook URLs, token, and timeout.
- Documented webhook configuration options in the documentation.
- Introduced zWebhookRequestSchema for validating webhook requests.
* feat(webhook): Update webhook handling and configuration
- Changed webhook operation type from "create" to "crawled" in crawlerWorker and documentation.
- Enhanced webhook retry logic in WebhookWorker to support multiple attempts.
- Updated Docker configuration to include new webhook environment variables.
- Improved validation for webhook configuration in shared config.
- Adjusted zWebhookRequestSchema to reflect the new operation type.
- Updated documentation to clarify webhook configuration options and usage.
* minor modifications
---------
Co-authored-by: Mohamed Bassem <me@mbassem.com>
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/docs/03-configuration.md | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/docs/docs/03-configuration.md b/docs/docs/03-configuration.md index 82438dbf..bf326aff 100644 --- a/docs/docs/03-configuration.md +++ b/docs/docs/03-configuration.md @@ -95,3 +95,36 @@ Hoarder uses [tesseract.js](https://github.com/naptha/tesseract.js) to extract t | OCR_CACHE_DIR | No | $TEMP_DIR | The dir where tesseract will download its models. By default, those models are not persisted and stored in the OS' temp dir. | | OCR_LANGS | No | eng | Comma separated list of the language codes that you want tesseract to support. You can find the language codes [here](https://tesseract-ocr.github.io/tessdoc/Data-Files-in-different-versions.html). Set to empty string to disable OCR. | | OCR_CONFIDENCE_THRESHOLD | No | 50 | A number between 0 and 100 indicating the minimum acceptable confidence from tessaract. If tessaract's confidence is lower than this value, extracted text won't be stored. | + +## Webhook Configs + +You can use webhooks to trigger actions when bookmarks are changed ( only support _crawled_ now ). + +| Name | Required | Default | Description | +| ------------------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | +| WEBHOOK_URLS | No | | The urls of the webhooks to trigger, separated by commas. | +| WEBHOOK_TOKEN | No | | The token to use for authentication. Will appears in the Authorization header as Bearer token. | +| WEBHOOK_TIMEOUT_SEC | No | 5 | The timeout for the webhook request in seconds. | +| WEBHOOK_RETRY_TIMES | No | 3 | The number of times to retry the webhook request. | + +:::info + +- If a url is add to hoarder , after it is crawled, the webhook will be triggered. +- The WEBHOOK_TOKEN is used for authentication. It will appear in the Authorization header as Bearer token. + ``` + Authorization: Bearer <WEBHOOK_TOKEN> + ``` +- The webhook will be triggered with the job id (used for idempotence), bookmark id, bookmark type, the user id, the url and the operation in JSON format in the body. + + ```json + { + "jobId": 123, + "type": "link", + "bookmarkId": "exampleBookmarkId", + "userId": "exampleUserId", + "url": "https://example.com", + "operation": "crawled" + } + ``` + + ::: |
