If you work on Linux command line very often, sometimes you may want to send text, files to your devices. telegram-send is such a tool to allow you sending messages across devices. Here is how to do it on Ubuntu 16:
Install telegram-send
To install telegram-send, run this command:
pip3 install telegram-send
Configure telegram
Assuming you already have a telegram account. If not, you need to register a telegram account: https://telegram.org/
Then run command:
$ telegram-send --configure
You will see the output like:
Talk with the BotFather on Telegram (https://telegram.me/BotFather), create a bot and insert the token
Now you need to create a telegram bot to deal with your requests. Open: https://telegram.me/BotFather, click "OPEN IN WEB"
Enter ‘/newbot’ then ‘YOUR_BOT_NAME’ to create a bot. Once you finish, you will see the response from BotFather:
Copy the token given by the BotFather and paste it to the command line window and you will see a message from command line window like:
Please add YOUR_BOT_NAME on Telegram (https://telegram.me/XXXX_bot)
and send it the password: YYYYYY
Follow the above instruction and enter the password in your browser, you will eventually see the message:
Congratulations XXXX!
telegram-send is now ready for use!
Now you may want to install Telegram to your devices. Actually, Telegram has native app on every device:
Test
To send a text to Telegram, just enter:
telegram-send "Hello, telegram"
To send an image, enter:
telegram-send --image 1.png --caption "optional image title"
To send a file, enter:
telegram-send --file FILENAME
Posted on Utopian.io - Rewarding Open Source Contributors