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 https://www.shodan.io/host/{{.Value}}
{{end -}}
{{end -}}
"
}
url: https://api.telegram.org/bot71765765:AAH2vhgfhgfdhgfhfghgfhfhhfghfhgsad/sendMessage
method: POST
headers:
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 https://api.telegram.org/bot71765765:AAH2vhgfhgfdhgfhfghgfhfhhfghfhgsad/sendMessage with body {\n \"chat_id\": \"-XXXXXXX\", \n \"text\": \"\n 192.168.1.238 will get ban for next 4h for triggering crowdsecurity/ssh-bf.\\r\\n https://www.shodan.io/host/192.168.1.238\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?
Regards