Using Telegram-cli on Raspberry Pi

Introduction

Several posts and articles about using Telegram-cli can be found on the internet covering from simple instant messages and file transfers to execution of commands, applications and actions on the operating system. Similar tasks can also be accomplished without installing Telegram on the target system using what are called bots or Telegram accounts that are operated by software and residing on the Telegram servers. Scripts can be run on the target system to interact with bots and execute the desired actions. For details and information on the Telegram bots you can refer to this link. To have a look over a complete application using a Telegram bot API this link from Luca Dentella is very good and easy to implement.

On this post I will show you how to install Telegram-cli using a Raspberry Pi 2 model B running Archlinux as well as how to trigger events as turning on an LED, receiving temperature information and taking and receiving a picture using Picamera.

Below picture shows the whole system.

all_system

And here a close up over the RPI 2

RPI_close

Installing Telegram.

All the Telegram-cli code and documentation is posted on GitHub by vysheng. The installation instruction covers several distros and platforms, but the information on the Archlinux section is intended for the Intel X86 or i686 architecture. For the ARM-7 architecture (Raspberry Pi), you have to download the source code, compile and build it. I will not re-invent the wheel here as there are several very good articles showing all details installing Telegram as for example this excellent post. Most published articles are based on RPI running Raspbian, which is not much of a difference , still this post shows the way I’ve successfully installed on Archlinux so let’s get started:

It is a good practice to update the system before installing applications, so lets run

In my case, the updating procedure took about 25 minutes, it will depend how old your installation or last update was.

Make a directory where you want to have the installation (usually under your home directory)

cd to above created directory (in my case $~/telegram) and run:

In case you do not have git installed just “pacman” it!

When it finishes downloading, continue with

Now, in my particular case and version of telegram , configure ended with the following error:

“ no libnconfig ; try configure –disable-libconfig.

But trying above ended up with another error

“no libjasson, try configure –disable-json . Therefore, I’ve ended running :

This worked with no errors. However , I did not want to have an installation missing stuff so I installed the missing dependencies as follows:

Now ./configure did worked fine and ended with no errors, so I’ve continued:

This took about 25 minutes in my case and ended with no errors.

That’s it! Telegram is installed so I’ve now typed in:

But it terminates immediately with errors as follows:

Leave a Reply

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