Archived
1
0
Fork 0

doc: Improve Telegram documentation (#7)

Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
Julien Riou 2022-02-27 20:30:24 +01:00
parent d2d1503779
commit e511eb89ef
No known key found for this signature in database
GPG key ID: FF42D23B580C89F7
2 changed files with 46 additions and 2 deletions

View file

@ -54,6 +54,50 @@ ls -l bin/flexassistant
## Configuration
### Telegram
Follow [this procedure](https://core.telegram.org/bots#3-how-do-i-create-a-bot) to create a bot `token`.
Then you have two possible destinations to send messages:
* channel using a `channel_name` (string)
* chat using a `chat_id` (integer)
For testing purpose, you should store the token in a variable for next sections:
```
read -s TOKEN
```
#### Chat
To get the chat identifier, you can send a message to your bot then read messages using the API:
```
curl -s -XGET "https://api.telegram.org/bot${TOKEN}/getUpdates" | jq -r ".result[].message.chat.id"
```
You can test to send messages to a chat with:
```
read CHAT_ID
curl -s -XGET "https://api.telegram.org/bot${TOKEN}/sendMessage?chat_id=${CHAT_ID}&text=hello" | jq
```
#### Channel
Public channel names can be used (example: `@mychannel`). For private channels, you should use a `chat_id` instead.
You can test to send messages to a channel with:
```
read CHANNEL_NAME
curl -s -XGET "https://api.telegram.org/bot${TOKEN}/sendMessage?chat_id=${CHANNEL_NAME}&text=hello" | jq
```
Don't forget to prefix the channel name with an `@`.
### flexassistant
*flexassistant* can be configured using a YaML file. By default, the `flexassistant.yaml` file is used but it can be
another file provided by the `-config` argument.

View file

@ -22,7 +22,7 @@ pools:
min-block-reward: 1.79
telegram:
chat-id: 000000000
channel-name: MyTelegramChannel
channel-name: @MyTelegramChannel
token: 0000000000000000000000000000000000000000000000
#notifications:
# balance:
@ -36,4 +36,4 @@ telegram:
# test: true
# payment:
# template: payment.tmpl
# test: true
# test: true