Synology DSM7 new feature: webhook

Well well, found the culprit, someone must have left dummy code in the DSM production release.

Digging around the filesystem I found the directory /usr/syno/etc which contains the configuration file of the webhook UI form: synowebhook.conf.

This is how mine looks like for the Webhook named “Postman”:

{"Postman":{"needssl":true,"port":443,"prefix":"A new system event occurred on your %HOSTNAME% on %DATE% at %TIME%.","req_header":"Content-Type:text/plain\rtestheader:testheadervalue\r","req_method":"post","req_param":"{\"MessCont\":\"@@FULLTEXT@@\",\"testbody\":\"testbodyvalue\"}","sepchar":" ","template":"postmanmockserverurlhere","type":"custom","url":"postmanmockserverurlhere"}}

or, formatted:

{
  "Postman": {
    "needssl": true,
    "port": 443,
    "prefix": "A new system event occurred on your %HOSTNAME% on %DATE% at %TIME%.",
    "req_header": "Content-Type:text/plain\rtestheader:testheadervalue\r",
    "req_method": "post",
    "req_param": "{\"MessCont\":\"@@FULLTEXT@@\",\"testbody\":\"testbodyvalue\"}",
    "sepchar": " ",
    "template": "postmanmockserverurlhere",
    "type": "custom",
    "url": "postmanmockserverurlhere"
  }
}

First thing we notice is the @@FULLTEXT@@ which is in place of the hello world “Message Content” required by the UI (wtf…), and also it’s unclear to me why the req_header escaping is done differently than the req_param but I’m not a developer so there may be a reason there.

Anyway, lo and behold, removing one @ in the .conf and then sending a test message via UI passes the headers and body correctly, with the exception of content-type which is overwritten/received as application\json not matter what I try.
Works as well in HA and the trace shows the testbody and MessCont both.

The issue is of course that FULLTEXT is probably supposed to be a placeholder for both the prefix field and the notification message.

Since I’m out of my depth here, do any of you know if it could be an escaping issue with the @@s, i.e. the webapp writes poorly its config file, or that part may be completely missing altogether?