Telegram Notification not working

Hi, trying to have notification on Telegram.
Took template of official documentation and just modified relevant data.

type: http
name: http_default

log_level: debug

format: |
   "chat_id": "-XXXXXXX",
   "text": "
     {{range . -}}  
     {{$alert := . -}}  
     {{range .Decisions -}}
     {{.Value}} will get {{.Type}} for next {{.Duration}} for  triggering {{.Scenario}}.\r\n{{.Value}}
     {{end -}}
     {{end -}}


method: POST
  Content-Type: "application/json"

But is not working. Form debug log i clearly see that POST is sent without text.

time="28-04-2022 14:28:26" level=info msg="received signal for http_default config" @module=http-plugin

time="28-04-2022 14:28:26" level=debug msg="adding header Content-Type: application/json" @module=http-plugin

time="28-04-2022 14:28:26" level=debug msg="making HTTP POST call to with body {\n \"chat_id\": \"-XXXXXXX\", \n \"text\": \"\n will get ban for next 4h for  triggering crowdsecurity/ssh-bf.\\r\\n\n   \"\n}\n" @module=http-plugin

time="28-04-2022 14:28:26" level=debug msg="got response {\"ok\":false,\"error_code\":400,\"description\":\"Bad Request: message text is empty\"}" @module=http-plugin

time="28-04-2022 14:28:26" level=warning msg="HTTP server returned non 200 status code: 400" @module=http-plugin```

Any idea?


Hi, just want to share solution found by myself.
In code example there is typo:

change from this:

format: |
   "chat_id": "-XXXXXXXX",

to this:

format: |
   "chat_id": XXXXXXX,

so without “-” (minus) and double quotas

1 Like

Thanks for sharing that with us!

This does not work for me, i keep getting the following response:
level=warning msg=“HTTP server returned non 200 status code: 400” @module=http-plugin

I have double checked the API and Chat id (by thge way, my chat ID starts indeed with the minus symbol -).
Any suggestions?
Thank you all

Hi, tried without “-” ?

Yes tried without - also without “”.
No luck so far

Can you post yuor configuration? Also entire logs.