# To send notifications to Telegram from Nagios Core
### Create a Telegram Bot
###### Open Telegram and search for the user @BotFather.Start a chat with BotFather and use the command /newbot.Follow the prompts to give your bot a name and username. After creating the bot, you will receive a token. Save this token, as you will need it for configuration.

### contacts.cfg
```bash
define contact {
contact_name nagiosadmin ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias Nagios Admin ; Full name of user
email vidkh1234@gmail.com ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
pager --chat-id
service_notification_commands notify-service-by-telegram
host_notification_commands notify-host-by-telegram
}
### commands.cfg
```bash
define command {
command_name notify-host-by-telegram
command_line /usr/bin/curl -X POST --data chat_id=$CONTACTPAGER$ \
--data parse_mode="markdown" \
--data text="%60$HOSTNAME$%60 %0A%0A$NOTIFICATIONTYPE$ %0A%60$HOSTSTATE$%60 %0A%60$HOSTADDRESS$%60 %0A%60$HOSTOUTPUT$%60" \
https://api.telegram.org/bot7570508012:AAG78Lf8P-ii0KLiQPvpStrlGmcdthrN6tc/sendMessage
}
define command {
command_name notify-service-by-telegram
command_line /usr/bin/curl -X POST --data chat_id=$CONTACTPAGER$ \
--data parse_mode="markdown" \
--data text="%60$HOSTNAME$%60 %0A%0A$NOTIFICATIONTYPE$ %0A%60$SERVICEDESC$%60 %0A%60$HOSTADDRESS$%60 %0A%60$SERVICESTATE$%60 %0A%60$SERVICEOUTPUT$%60" \
https://api.telegram.org/bot6207875474:AAGQxHY1LghTP9taYuaikKANsAMQHnMPCgM/sendMessage
}