My goal is to send an HTTP command to the Synology Chat bot.
In Synology's cookbook, it is described as follows.
Place the JSON string after the payload application / x-www-form-urlencoded data parameter to the webhook url. Example:
POST https://DS_IP/webapi/entry.cgi?api=SYNO.Chat.External&XXXXX Content-Type: application/x-www-form-urlencoded payload=%7B%22text%22%3A%22This%20is%20a%20test.%22%7D
Below is an example of CURL:
curl -X POST \ --data-urlencode 'payload={"text": "This is a test"}' \ https://DS_IP/webapi/entry.cgi?api=SYNO.Chat.External&XXXXX
Now I've got it with the CURL as follows. This is how it works with CURL:
[{"id":"ebd7f583394363ac","type":"inject","z":"8ed57a821485ba05","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":100,"y":1000,"wires":[["eaa380d9.07f03"]]},{"id":"eaa380d9.07f03","type":"template","z":"8ed57a821485ba05","name":"SynoChat","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":" curl -X POST \"http://192.168.178.10:5000/webapi/entry.cgi?api=SYNO.Chat.External&method=incoming&version=2&token=%2236rQjLXdWCSZPPqIS0GW3ZvmarvKdlRMLXXJrRcWq9vjQYH16HkozhFFXIVtgVBN%22\" \\\n -H \"Content-Type: application/x-www-form-urlencoded\" \\\n --data-urlencode 'payload={\"text\": \"This is a test\"}'\n","output":"str","x":300,"y":1000,"wires":[["e5236a1a.6e8fe8"]]},{"id":"e5236a1a.6e8fe8","type":"exec","z":"8ed57a821485ba05","command":"","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":530,"y":1000,"wires":[["7573266c35d80c6c"],[],[]]}]
Now I thought to myself that it should actually work with the HTTP request. My attempts look like this. Unfortunately I haven't had any success with that yet.
[{"id":"9fd5792ee92e48fe","type":"http request","z":"8ed57a821485ba05","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"http://192.168.178.10:5000/webapi/entry.cgi?api=SYNO.Chat.External&method=incoming&version=2&token=%2236rQjLXdWCSZPPqIS0GW3ZvmarvKdlRMLXXJrRcWq9vjQYH16HkozhFFXIVtgVBN%22","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":510,"y":880,"wires":[[]]},{"id":"5a4ab97bf3103393","type":"change","z":"8ed57a821485ba05","name":"SynoChat","rules":[{"t":"set","p":"headers","pt":"msg","to":"{\"content-type\":\"application/x-www-form-urlencoded\"}","tot":"json"},{"t":"set","p":"payload","pt":"msg","to":"{\"text\":\"This is a test\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":880,"wires":[["9fd5792ee92e48fe"]]},{"id":"ebd7f583394363ac","type":"inject","z":"8ed57a821485ba05","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":140,"y":880,"wires":[["5a4ab97bf3103393"]]}]
The following error message then appears:
{"error":{"code":120,"errors":{"name":"payload","reason":"required"}},"success":false}
Since it works with the CURL command, it should also work with the HTTP command. Is anyone able to help me?