# Watcher webhook send message to telegram bot issue

**URL:** https://discuss.elastic.co/t/watcher-webhook-send-message-to-telegram-bot-issue/224424
**Category:** Elasticsearch
**Tags:** elastic-stack-alerting
**Created:** [March 20, 2020, 1:41pm UTC](https://discuss.elastic.co/t/watcher-webhook-send-message-to-telegram-bot-issue/224424 "2020-03-20T13:41:50Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Robin020](https://avatars.discourse-cdn.com/v4/letter/r/71c47a/32.png) [@Robin020](https://discuss.elastic.co/u/Robin020)
#### Post date: [March 20, 2020, 1:41pm UTC](https://discuss.elastic.co/t/watcher-webhook-send-message-to-telegram-bot-issue/224424/1 "2020-03-20T13:41:50Z")

</div>

Hi,

I wrote a watcher which send a message (via Webhook) to my twitterbot.

Let start with my config:

```
"actions": {
    "my_webhook": {
      "webhook": {
        "scheme": "https",
        "host": "api.telegram.org/bot{number}/sendMessage?chat_id={number}&disable_web_page_preview=1&parse_mode=Markdown&text=test",
        "port": 443,
        "method": "GET"
      }
    }
  }

```

I put not only the domainname ([api.telegram.org](http://api.telegram.org)) of the twitterbot in the "host" field but also the full path behind it. Otherwise it won't work for me. So like this:  
`api.telegram.org/bot{number}/sendMessage?chat_id={number}&disable_web_page_preview=1&parse_mode=Markdown&text=test"`

The problem is that the port field value will be put in the url after the domain.  
So like this:  
`api.telegram.org:443/bot{number}/sendMessage?chat_id={number}&disable_web_page_preview=1&parse_mode=Markdown&text=test"`

Is it possible to filter out the port field in the url?  
Or should I use an other method?

Best regards,  
Robin

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [March 20, 2020, 3:56pm UTC](https://discuss.elastic.co/t/watcher-webhook-send-message-to-telegram-bot-issue/224424/2 "2020-03-20T15:56:52Z")

</div>

hey,

host is only the hostname without the path or the parameters. If you want to use mustache parameters, you need to use the `path` variable.

See [https://www.elastic.co/guide/en/elasticsearch/reference/7.6/actions-webhook.html](https://www.elastic.co/guide/en/elasticsearch/reference/7.6/actions-webhook.html)

--Alex

---

<div class="post-metadata">

### Author: ![Robin020](https://avatars.discourse-cdn.com/v4/letter/r/71c47a/32.png) [@Robin020](https://discuss.elastic.co/u/Robin020)
#### Post date: [March 20, 2020, 4:57pm UTC](https://discuss.elastic.co/t/watcher-webhook-send-message-to-telegram-bot-issue/224424/3 "2020-03-20T16:57:18Z")

</div>

Hi Alex,

That won't work because my url will be parsed into an invalid url:  
`api.telegram.org:443/bot{number}/sendMessage?chat_id={number}&disable_web_page_preview=1&parse_mode=Markdown&text=test"`

The portnumber should be added at the end.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [April 17, 2020, 4:57pm UTC](https://discuss.elastic.co/t/watcher-webhook-send-message-to-telegram-bot-issue/224424/4 "2020-04-17T16:57:19Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
