Nodejs wrapper that communicates with the Telegram API.
This repository has become obsolete as Telegram has released the bot api https://core.telegram.org/bots/api. This is an easier way to programmatically interact with Telegram.
Underlyingly makes use of telegram-cli (https://github.com/vysheng/tg).
##Installation
- To run it locally run the following command:
git clone --recursive git@github.com:tincann/telegram-cli-wrapper.git
The --recursive
argument is important, as it will also install the submodules of tg.
- Afterwards install all dependencies by running:
sudo apt-get install libreadline-dev libconfig-dev libssl-dev libevent-dev make
- Then run:
npm install
This will compile the code in the included tg submodule into the tg/bin
directory.
##Running it the first time
While in the root of this project, first run the binary in the tg/bin
directory by doing:
./tg/bin/telegram-cli -k tg/server.pub
Then you should set up access to a telegram account by following the steps in the cli. Please refer to the README of the cli (https://github.com/vysheng/tg).
After this is done you can use the TelegramAPI object in the lib directory. Usage example:
var tgapi = require('./lib/telegram-api.js');
tgapi.connect(function(connection){
connection.on('message', function(message){
console.log('message:', message);
});
});
##Windows
Haven't tested this for Windows (yet)