Install telegram cli and send messages from shell linux

Tutorial to installation telegram cli (Command line interface) on debian/raspbian/bananian

Install git if you don’t have it

apt-get install git

Clone from git

git clone --recursive https://github.com/vysheng/tg.git

or download the master file and uncompress

wget https://github.com/vysheng/tg/archive/master.zip -O tg-master.zip
apt-get install unzip
unzip tg-master.zip
cd tg-master

Install libs
sudo apt-get install libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev libevent-dev
apt-get install gcc
apt-get install make

Configure and make
./configure
make

after compiled, the only files you need are telegram and tg-server.pub

run from the folder with
./telegram

First time run program, he ask to sign up with a mobile number.
in your home directory will be created a hidden folder .telegram.
This directory contain the auth and other files.
For send message:
msg contactName message

for exit:
quit

Multiuser (?):

you can copy telegram in /usr/bin:
mv telegram /usr/bin/telegram
make a config dir in etc
mkdir /etc/telegram
move .telegram-cli from home to etc
mv .telegram-cli /etc/telegram/telegram-cli
edit config file
nano /etc/telegram/telegram-cli/config
and insert this:

default_profile = "main";
main = {
config_directory = "/etc/telegram/telegram-cli";
};

move tg-server.pub
mv tg-server.pub /etc/telegram/server.pub

set correct permissions

now use with:

telegram -k /etc/telegram/server.pub -c /etc/telegram/telegram-cli/config

 

 

read this post for create send script.

3 thoughts on “Install telegram cli and send messages from shell linux

  1. trying make command I got error:
    $ make
    make: *** No targets specified and no makefile found. Stop.

    can you please help me?

Leave a Reply

Your email address will not be published. Required fields are marked *