---

Alias: ["Telegram bot"]
Tag: ["💻", "🖥️", "📟", "🔎"]
Date: 2022-03-10
DocType: "Personal"
Hierarchy: "NonRoot"
TimeStamp:
location:
CollapseMetaTable: true

---

Parent:: [[Selfhosting]], [[Server Alias]], [[Server Cloud]], [[Server Tools]], [[Server VPN]]

---

&emsp;

```button
name Save
type command
action Save current file
id Save
```
^button-ConfiguringTelegrambotsNSave

&emsp;

# Configuring Telegram bots

&emsp;

```ad-abstract
title: Summary
collapse: open
This note allows to configure Telegram bots for pairing with certain services.
```

&emsp;

```toc
style: number
```

&emsp;

---

&emsp;

### Linking services with a Telegram bot

&emsp;

#### Creating a Telegram Bot

1. In Telegram, look for '@BotFather'
2. Initialise with `/start`
3. Create bot with `/newbot`

Record the Token from the message from *BotFather*.

&emsp;

#### Getting the Bot's Chat ID

In a terminal, run:

```ad-command
title: Telegram Chat ID
~~~bash
curl https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/getUpdates | jq .message.chat.id
~~~
```


&emsp;

#### Linking Logwatch

Please see full documentation [[GitHub - fxkjdlogwatch-telegram-bot Send logwatch results to your telegram account|here]].

&emsp;

#### Linking monit

Please see full documentation [[GitHub - matriphemonit2telegram A simple script to send Monit alerts using Telegram bot.|here]].

&emsp;

#### Linking fail2ban

Please see full documentation [[GitHub - deividgdtfail2ban_telegram_notifications Sending fail2ban notifications using a Telegram bot|here]] for SSH monitoring.

&emsp;

---

&emsp;

### Current bots

&emsp;

#### Logwatch and Monit

A bot has been created for [[Configuring Monit|monit]] and Logwatch.

&emsp;

```ad-credentials
title: Credentials
| Variable | Value
| - | -
| Name | Logwatch_servers
| Username | [mbvservers_bot](https://t.me/mbvservers_bot)
| Token | 5218097204:AAEnsZLTk4TTk-X-MceuoIGX0IQWLkngM4E
| Chat ID | 1622082350
```

&emsp;

#### Alias Server

```ad-credentials
title: Credentials
| Variable | Value
| - | -
| Name | Alias Server
| Username | [AliasServer_bot](https://t.me/AliasServer_bot)
| Token | 5152026161:AAEz4uzDmu8NwrQ5keVmeQNoW4crFVNA0Mg
| Chat ID | 1622082350
```

&emsp;

#### Cloud Server

```ad-credentials
title: Credentials
| Variable | Value
| - | -
| Name | Cloud Server
| Username | [CloudServer_mfxm_bot](https://t.me/CloudServer_mfxm_bot)
| Token | 5195880175:AAHn9EeBWX0tNszSX4MvWUtJ2I3K8wmCIKw
| Chat ID | 1622082350
```

&emsp;

#### Tools Server

```ad-credentials
title: Credentials
| Variable | Value
| - | -
| Name | Tools Server
| Username | [Tools_mfxm_bot](https://t.me/Tools_mfxm_bot)
| Token | 5084726395:AAGCxr7VvG_fsrO7JWexlQgPt3dtwCijKjY
| Chat ID | 1622082350
```

&emsp;

#### VPN Server

```ad-credentials
title: Credentials
| Variable | Value
| - | -
| Name | VPN Server
| Username | [VPN_mfxm_bot](https://t.me/VPN_mfxm_bot)
| Token | 5159102890:AAFt6QIaUiWZsskc9CFveJBHORjmZYgzTiE
| Chat ID | 1622082350
```

&emsp;
&emsp;