How to send text and files to other devices in Linux command line via Telegram

in #utopian-io7 years ago

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

Sort:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Thank you

Hey @yuxid I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Suggestions

  • Contribute more often to get higher and higher rewards. I wish to see you often!
  • Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!

Get Noticed!

  • Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x