A simple API server for forwarding message to Telegram accounts
855
A simple API server for forwarding message to Telegram accounts
telegram-notify \
-l="[ip]:port" \
-t="<Telegram Token>" \
-m="<text|html|markdown>" \
-r="[<from>:<id,...>;]<id,...>"
docker run -d \
--name=telegram-notify \
--restart=unless-stopped \
-p 8000:8000 \
-e TOKEN="<Telegram Token>" \
-e MODE="<text|html|markdown>" \
-e RULE="[<from>:<id,...>;]<id,...>" \
nfam/telegram-notify
| Argument | Environment variable | Default | Function |
|---|---|---|---|
-l | LISTEN | :8000 | IP address (optional) and the port. |
-t | TOKEN | Telegram bot token. | |
-m | MODE | text | Telegram message mode which can be text, html, or markdown. |
-r | RULE | Message forwarding rule(s) in format "[<from>:<id,...>;]<id,...>". See rule rule example. |
The rule service1:11,12;service2:21,22;31,33 indicates:
service1 will be forwarded to accounts 11 and 12.service2 will be forwarded to accounts 21 and 22.31 and 32.In order to send a Telegram message, make a POST request to http://localhost:8000/notify with 3 optional query from, sound, and mode.
from query indicates the sender,sound which can be on or off (default), indicates whether to ring a tone on the receiver app, andmode indicates the text mode which is text, html, or markdown. If mode is missing, the value from server argument will be employed.For example:
curl -X POST \
-d 'failed to backup' \
'http://localhost:8000/notify?from=service1&mode=html'
will send the following message to accounts 11 and 12
<b>service1:</b> failed to backup
Content type
Image
Digest
Size
2.1 MB
Last updated
over 5 years ago
docker pull nfam/telegram-notify