backrest icon indicating copy to clipboard operation
backrest copied to clipboard

Help to send notifications contents to a webhook

Open lordraiden opened this issue 4 months ago • 1 comments

I need help creating the script to send the ouput of the notifications to a webhook. I am getting parsing errors.... Can someone help me please?

/usr/bin/curl -X POST \
  -H "Content-Type: application/json" \
  -H "X-N8N-TOKEN-NOTIFICATION: aaa" \
  --data-binary '{"summary": "{{ .Summary }}"}' \
  "https://n8n.test.es/webhook/f70542ed-645e-42f6-91e3-18606b9c6257"

Image

This is the output

[script] [sh]
[script] /usr/bin/curl -X POST \
[script]   -H "Content-Type: application/json" \
[script]   -H "X-N8N-TOKEN-NOTIFICATION: aaa" \
[script]   --data-binary '{"summary": "
[script] Backrest Notification
[script] Task: prune repo "Local" at 2025-08-13T17:50:28+02:00
[script] Event: prune success
[script] 
[script] "}' \
[script]   "https://n8n.test.es/webhook/f70542ed-645e-42f6-91e3-18606b9c6257"
[output]   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
[output]                                  Dload  Upload   Total   Spent    Left  Speed
[output] 
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   258  100   144  100   114   3803   3011 --:--:-- --:--:-- --:--:--  6972
[output] {"code":422,"message":"Failed to parse request body","hint":"Bad control character in string literal in JSON at position 13 (line 1 column 14)"}[tasklog] 17:50:28.597Z	info	run hook command hook repo/Local/hook/1	task finished	{"duration": 0.046643806}
Image

lordraiden avatar Aug 13 '25 15:08 lordraiden

Use Shoutrrr instead using the "generic webhook service": https://containrrr.dev/shoutrrr/v0.8/services/generic/

lesleyxyz avatar Nov 03 '25 23:11 lesleyxyz