ADD: Telegram bot as notification provider

This commit is contained in:
Christian Kellner
2018-02-06 13:57:32 +01:00
parent 97d7ba7f9a
commit f0d9c0cb00
9 changed files with 579 additions and 23 deletions

View File

@@ -28,9 +28,11 @@ cp conf/config.example conf/config.json
### 1. Notification
You want to get notified when _Fredy_ found a new listing. Currently _Fredy_ support Slack to send notification. _Fredy_ also includes a notification adapter to print to the console instead of sending to a services.
You want to get notified when _Fredy_ found a new listing. Currently _Fredy_ support Slack and Telegram to send notification. _Fredy_ also includes a notification adapter to print to the console instead of sending to a services.
Adding new notification adapter is easy however. See [Contribution](https://github.com/orangecoding/fredy/blob/master/CONTRIBUTION.md)
Adding new notification adapter is easy however. See [Contribution](https://github.com/orangecoding/fredy/blob/master/CONTRIBUTION.md)
##### Slack
```json
"slack": {
"channel": "someChannel",
@@ -39,6 +41,21 @@ Adding new notification adapter is easy however. See [Contribution](https://gith
}
```
##### Telegram
```json
"telegram": {
"chatId": "someChannel",
"token": "someToken",
"enabled": true
}
```
For Telegram, you need to create a Bot. This is pretty easy. Open [this](https://telegram.me/BotFather) url on your smartphone and follow the instructions.
A telegram bot is not allowed to send messages directly to a user, you as a user need to first contact the bot to get a chatId.
After the user has send a message to your bot the first time, you can gather the chatId like this: `$ curl -X GET https://api.telegram.org/botYOUR_API_TOKEN/getUpdates`
A more detailed list of instructions can be found here [https://core.telegram.org/bots#botfather](https://core.telegram.org/bots#botfather)
### 2. Configure the providers
Configure the providers like described below. To disable a provider just remove its entry from the configuration or set it to `false`.