https://github.com/korotin/tgsay
Send messages to Telegram via CLI
https://github.com/korotin/tgsay
cli telegram
Last synced: over 1 year ago
JSON representation
Send messages to Telegram via CLI
- Host: GitHub
- URL: https://github.com/korotin/tgsay
- Owner: korotin
- Created: 2018-12-15T11:07:12.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-23T13:12:59.000Z (over 7 years ago)
- Last Synced: 2025-02-04T21:18:52.526Z (over 1 year ago)
- Topics: cli, telegram
- Language: PHP
- Homepage:
- Size: 10.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
tgsay
=====
**tgsay** sends messages to Telegram via CLI. It may be used in shell scripts, cron commands, monitoring systems etc.
Requirements
------------
* *nix
* PHP >= 7.2
* cURL extension
Installation
------------
1. Copy `tgsay` inside your `$PATH`.
2. If you don't have a Telegram bot yet be sure to [create one](https://core.telegram.org/bots#3-how-do-i-create-a-bot).
3. Create config (default path is `~/.config/tgsay.ini` or `/etc/tgsay.ini`):
```ini
[bots]
; keys are bot aliases, not the actual bot names, must have at least one
JenkinsBot =
ZabbixBot =
[chats]
; same here: keys are just aliases, must have at least one
Myself =
TeamChat =
AlertChannel =
[defaults]
; defaults will be used if corresponding arguments are skipped, optional
bot =
chat =
```
Usage
-----
Send message using specific bot and chat:
```bash
tgsay --bot="JenkinsBot" --chat="TeamChat" --msg="Build completed"
```
Send message using defaults:
```bash
tgsay --msg="Everything is fine"
```
Send silent message:
```bash
tgsay --msg="This one isn't really urgent" --slient
```
Send preformatted message:
```bash
tgsay --msg="But this one *urgent* a lot" --md
```
Use STDIN to pass message body:
```bash
cat build_log | tgsay
```
Please refer to built-in help to get more information on available options.