# Telegram Notification not working

**URL:** https://discourse.crowdsec.net/t/telegram-notification-not-working/755
**Category:** Uncategorized
**Created:** [April 28, 2022, 12:59pm UTC](https://discourse.crowdsec.net/t/telegram-notification-not-working/755 "2022-04-28T12:59:09Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![spady7](https://dub1.discourse-cdn.com/flex013/user_avatar/discourse.crowdsec.net/spady7/32/348_2.png) [@spady7](https://discourse.crowdsec.net/u/spady7)
#### Post date: [April 28, 2022, 12:59pm UTC](https://discourse.crowdsec.net/t/telegram-notification-not-working/755/1 "2022-04-28T12:59:09Z")

</div>

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

```auto
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.

````auto
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
````

---

<div class="post-metadata">

### Author: ![spady7](https://dub1.discourse-cdn.com/flex013/user_avatar/discourse.crowdsec.net/spady7/32/348_2.png) [@spady7](https://discourse.crowdsec.net/u/spady7)
#### Post date: [April 29, 2022, 12:12pm UTC](https://discourse.crowdsec.net/t/telegram-notification-not-working/755/2 "2022-04-29T12:12:36Z")

</div>

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

change from this:

```auto
format: |
  {
   "chat_id": "-XXXXXXXX",

```

to this:

```auto
format: |
  {
   "chat_id": XXXXXXX,

```

so without “-” (minus) and double quotas  
Regards

---

<div class="post-metadata">

### Author: ![klausagnoletti](https://dub1.discourse-cdn.com/flex013/user_avatar/discourse.crowdsec.net/klausagnoletti/32/201_2.png) [@klausagnoletti](https://discourse.crowdsec.net/u/klausagnoletti)
#### Post date: [May 9, 2022, 10:38am UTC](https://discourse.crowdsec.net/t/telegram-notification-not-working/755/3 "2022-05-09T10:38:10Z")

</div>

Thanks for sharing that with us!

---

<div class="post-metadata">

### Author: ![lucianlazar1983](https://dub1.discourse-cdn.com/flex013/user_avatar/discourse.crowdsec.net/lucianlazar1983/32/365_2.png) [@lucianlazar1983](https://discourse.crowdsec.net/u/lucianlazar1983)
#### Post date: [May 9, 2022, 3:24pm UTC](https://discourse.crowdsec.net/t/telegram-notification-not-working/755/4 "2022-05-09T15:24:28Z")

</div>

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

---

<div class="post-metadata">

### Author: ![spady7](https://dub1.discourse-cdn.com/flex013/user_avatar/discourse.crowdsec.net/spady7/32/348_2.png) [@spady7](https://discourse.crowdsec.net/u/spady7)
#### Post date: [May 12, 2022, 2:53pm UTC](https://discourse.crowdsec.net/t/telegram-notification-not-working/755/5 "2022-05-12T14:53:26Z")

</div>

Hi, tried without “-” ?

---

<div class="post-metadata">

### Author: ![lucianlazar1983](https://dub1.discourse-cdn.com/flex013/user_avatar/discourse.crowdsec.net/lucianlazar1983/32/365_2.png) [@lucianlazar1983](https://discourse.crowdsec.net/u/lucianlazar1983)
#### Post date: [May 12, 2022, 3:24pm UTC](https://discourse.crowdsec.net/t/telegram-notification-not-working/755/6 "2022-05-12T15:24:41Z")

</div>

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

---

<div class="post-metadata">

### Author: ![spady7](https://dub1.discourse-cdn.com/flex013/user_avatar/discourse.crowdsec.net/spady7/32/348_2.png) [@spady7](https://discourse.crowdsec.net/u/spady7)
#### Post date: [May 12, 2022, 3:57pm UTC](https://discourse.crowdsec.net/t/telegram-notification-not-working/755/7 "2022-05-12T15:57:42Z")

</div>

Can you post yuor configuration? Also entire logs.
