telegram-send

There is a little Python command line program called telegram-send to send messages to you telegram account.

First you need to register a new bot from BotFather and get a key. Then you pip3 install --user telegram-send and prepare a config file in ~/.config/telegram-send.conf

[telegram]
token = <TOKEN_YOU_GET_FROM_BOT_FATHER>
chat_id = <CHAT OR USER ID> 

You need to start a conversation with the bot and learn your user id (that’s identical with the chat id you start with the bot.)

After that you can send yourself messages from cli like:

telegram-send "hello telegram."

and also send markdown formatted messages, audio, stickers etc by command line options.


usage: telegram-send [-h] [--format {text,markdown,html}] [--stdin] [--pre]
                     [--disable-web-page-preview] [--silent] [-c]
                     [--configure-channel] [--configure-group]
                     [-f FILE [FILE ...]] [-i IMAGE [IMAGE ...]]
                     [-s STICKER [STICKER ...]]
                     [--animation ANIMATION [ANIMATION ...]]
                     [--video VIDEO [VIDEO ...]] [--audio AUDIO [AUDIO ...]]
                     [-l LOCATION [LOCATION ...]]
                     [--caption CAPTION [CAPTION ...]] [--config CONF] [-g]
                     [--file-manager] [--clean] [--timeout TIMEOUT]
                     [--version]
                     [message [message ...]]

Comments