From dab29e72671ab26fc80918d7168b681e7ce9b4ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C4=81rlis=20K?= Date: Wed, 31 Aug 2022 11:30:47 +0300 Subject: [PATCH] Update Hook-Examples.md (#576) Synology webhook example --- docs/Hook-Examples.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/docs/Hook-Examples.md b/docs/Hook-Examples.md index 05f9a23..d970104 100644 --- a/docs/Hook-Examples.md +++ b/docs/Hook-Examples.md @@ -21,6 +21,7 @@ although the examples on this page all use the JSON format. * [XML Payload](#xml-payload) * [Multipart Form Data](#multipart-form-data) * [Pass string arguments to command](#pass-string-arguments-to-command) +* [Receive Synology DSM notifications](#receive-synology-notifications) ## Incoming Github webhook @@ -636,3 +637,39 @@ The following example will pass two static string parameters ("-e 123123") to th } ] ``` + +## Receive Synology DSM notifications + +It's possible to securely receive Synology push notifications via webhooks. +Webhooks feature introduced in DSM 7.x seems to be incomplete & broken, but you can use Synology SMS notification service to push webhooks. To configure SMS notifications on DSM follow instructions found here: https://github.com/ryancurrah/synology-notifications this will allow you to set up everything needed for webhook to accept any and all notifications sent by Synology. During setup an 'api_key' is specified - you can generate your own 32-char string and use it as an authentication mechanism to secure your webhook. Additionally, you can specify what notifications to receive via this method by going and selecting the "SMS" checkboxes under topics of interes in DSM: Control Panel -> Notification -> Rules + +```json +[ + { + "id": "synology", + "execute-command": "do-something.sh", + "command-working-directory": "/opt/webhook-linux-amd64/synology", + "response-message": "Request accepted", + "pass-arguments-to-command": + [ + { + "source": "payload", + "name": "message" + } + ], + "trigger-rule": + { + "match": + { + "type": "value", + "value": "PUT_YOUR_API_KEY_HERE", + "parameter": + { + "source": "header", + "name": "api_key" + } + } + } + } +] +```