Raspberrygrams
What's cool about the Telegram messaging app is that – more than just a WhatsApp clone – you can use it to send and receive messages from your Raspberry Pi and even program it as an autoresponder.
What's cool about the Telegram messaging app is that – more than just a WhatsApp clone – you can use it to send and receive messages from your Raspberry Pi and even program it as an autoresponder.
The Telegram app [1] is taking the techie community by storm. Maybe not all your friends use it, but it has enough cool features to make it fascinating for people who like to tinker.
Apart from regular features, like chatting, groups, and being able to send pics and short video or audio files, Telegram boasts end-to-end encrypting (no more NSA spying on your chats), cloud-distributed servers (more reliable connections), secret chats, and auto-destructing messages (set a time limit, e.g., 1 minute, and the message disappears from your device and your friend's device).
As if that were not enough, Telegram is open source, uses an open protocol, and has a public API, which means that any developer can create new clients for different platforms. Although it's officially intended for iOS and Android, unofficial ports have been made to Windows Phone, Windows, the web, and the Raspberry Pi's Linux command line (Figure 1), which I will talk about in this article.
If you have an Android handset or an iPhone, you can get Telegram from Google Play or the Apple App Store. If you haven't done so already, I would advise doing so and setting up an account from your phone before proceeding. To run Telegram from your Raspberry Pi, you are going to have to download the source code and compile it.
To do so, click the Download ZIP button on the right side of the web page [2], or you can clone the directory directly onto your Pi:
$ git clone https://github.com/vysheng/tg.git
This will probably take a while.
Before you start the compile proper, you're going to need some packages to satisfy Telegram's dependencies:
$ sudo libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev
If you downloaded the ZIP, unzip it and enter the resulting directory:
$ unzip tg-master.zip $ cd tg-master
If, on the other hand, you decided to clone the directory from source, once it has finished downloading, you can enter the directory right away:
$ cd tg
Regardless of how you decided to get the source, the next step is configuring the makefile for the compile:
$ ./configure
Then, start the compile proper:
$ make
Once finished, you should have an executable program called telegram
in the tg
directory.
Before you start texting from the command line, you have to connect your Pi to your Telegram account and associate it with your mobile phone number. To do this, run Telegram with the -k
option and point it to the public key in the tg
directory:
$ ./telegram -k tg.pub
The program then asks you for a code that is sent to your phone via SMS and which you receive in a few seconds after registering (Figure 2).
After entering the code, your connected contacts show up, as shown in Figure 3. You will also see a >
at the bottom. This is the Telegram command-line prompt, and what you type shows up here.
Pages: 4
Price $15.99
(incl. VAT)