enricostara / telegram.link Goto Github PK
View Code? Open in Web Editor NEWTelegram API library (javascript, node.js)
Home Page: www.telegram.link
License: MIT License
Telegram API library (javascript, node.js)
Home Page: www.telegram.link
License: MIT License
i have telegram account but after sign in i got an error : PHONE_NUMBER_UNOCCUPIED
what's wrong ?
The library prints its name and version when required.
telegram.link/lib/telegram.link.js
Line 27 in ab6f693
Is it available now?
How to?
The introduction says
To start with the telegram.link library, you can install and study the Termgram application.
With the word "Termgram" linking to http://termgram.me/
Currently that appears to be dead:
$ dig termgram.me
; <<>> DiG 9.10.3-P4-Debian <<>> termgram.me
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 31843
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;termgram.me. IN A
I can send English text and numbers easily via telegram.link.messages.sendMessage.
But when I'm trying to send non-English text (like Cyrillic characters, or Japanese characters etc) I'm getting an error INPUT_REQUEST_TOO_LONG
.
I've checked everything: my text is utf8 and it's less than 4096.
Hi,
How can create a Vector and ImportContacts?
Will you continue working on the lib?
THX.
Is this still maintained?
Please add the method to logout properly
Hello!
Is there any samples, how to implement unimplemented api methods?
I want to use https://core.telegram.org/methods#working-with-chats and https://core.telegram.org/methods#working-with-contacts sections, but there is no implementation in telegram.link :(
Hi
Sorry,I have a question about your project(telegram).
Can I get the message channels that I'm not their admin?
I want write a script that read message from other chanel and write to
my chanel.
I can do it?
I can use messages.getHistory(peer, offset, max_id, limit, [callback])
fot do it(how can find perr)?
best regards
thanks
Hi Enrico,
I have similar issue to #8 , but decided to open a new issue too cause issue #8 is closed and you could leave my comment without attention.
My purpose is to know whether the passed phone number was registered in Telegram or no. I have same problem when requesting with your library auth.checkPhone method, which even doesn't requre authorization according API docs.
Here is my script
var data = {} // Hold all global data
data.telegramLink = require('../telegram.link')();
data.app = {
id: 12345,
hash: '12345678901234567890',
version: '1.0.0',
lang: 'en'
};
data.client = data.telegramLink.createClient(data.app, data.telegramLink.TEST_PRIMARY_DC, function(ex){
if(!ex) {
console.log('Connected to Telegram!');
data.client.auth.checkPhone('79885851900', function (result) {
console.log(result);
});
}
else {
console.log(ex);
}
})
I have checked and tested telecommander.js, it works fine. My code is very similar to it, but I can't figure out what's wrong.
Please help to correct my code.
thank!
this looks like an impressive project!
what is the main goal of the project to differentiate from features in the bot API?
it maybe interesting to prioritize APIs that are not available through the public (and easy to use) bot API?
I don't have a full list but group/spam management is badly needed within TG. creating groups and managing user add/remove is not there in the bot api. ~= an open source liberbot...
Hi Pal,
Am new to Telegram api.
Am currently trying to implement Telegram in an Ionic / Cordova app, can this code base be intergraded on a mobile device or does it need to run on a node server,
Also do you have a basic example on how to get this up and running.
Hello.
I'm using this code:
https://gist.github.com/overjt/ae2ebc85b8308beac40c
data.onPhoneNumber = function(s) {
if (data.user === undefined) {
data.user = {};
}
data.user.phone = s.trim();
//i.close();
console.log('Checking your phone number with Telegram...');
data.client.auth.sendCode(data.user.phone, 5, 'en', function(result) {
console.log("never called");
console.log(result);
});
}
The login code arrives but the function passed as callback is never executed.
there's something I'm doing wrong?
Hi. Where can i see example of usage.
authorize
get messages
mark read
send message
Hi!
i need send a message to a bot.
i used telegramLink.type.InputPeerChat and telegramLink.type.InputPeerContact
but i received a PEER_ID_INVALID
any idea?
thanks!!
Cheers
Hi there! How to collect all your necessary libs in one place without a NODEjs for using in my css+html+js application ? Have you some instruction for this situation?
C:\Users\juanpotato\Documents\telegram.link>npm test
> [email protected] test C:\Users\juanpotato\Documents\telegram.link
> DEBUG=-mocha*,-TypeBuilder,* ./node_modules/gulp/bin/gulp.js test
'DEBUG' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! Test failed. See above for more details.
I'm on windows 10 and have run npm install
before running test, what do I do?
I want to make custom web version of telegram like web.telegram.org.
Can you make some document that shows how to use telegram.link for browser?
It's possible?
Hi,
How can i upgrade to layer 54?
here is schema but it seems telegram.link need to json of it
https://github.com/telegramdesktop/tdesktop/blob/master/Telegram/SourceFiles/mtproto/scheme.tl
Can i convert this to json and use in telegram.link?
@MunawwarHussain @enricostara @Morosko
Best Regards.
Hi, thank you for your work!
Is there any plans to implement conact.importContacts?
If you download the code and follow the instruction to test it (just exec npm test
), the tests are failling. Don't know if the library needs some configuration an the readme needs to be updated, or it's a problem in the dependencies... :-/
In my client I have
client.startHttpPollLoop(function(data) {});
client.registerOnUpdates(function(data) {
// create notification when the update holds a message
});
And when someone sends me a message I receive infinite notifications. Do I have to tell the server somehow I ve received the update or is it a bug in the API?
On the telegram api homepage it states:
the current value of seq should be overwritten with the value in the update’s seq field
So i checked if the API does so by calling updates.getDifference. Telegram.link does what it should do, but why do I keep getting the updates then?
Hi
Was thinking about making an irc->Telegram gateway, and found this to be looking interesting? Is the project status up to date with the readme, or how far have you come?
Thanks,
Walliski
Hi ..
First of all i have to say thank you for telegram.link
Actually i have some problem with telegram.link and now i can't send a message from it through telegram(the only thing that i need for now).As a matter of fact i'm a Asp.net MVC programmer and Node.Js is not my expert but when i saw your project on Github i started to learn Node.Js so i'm just beginner in Nod.Js and i'm really confused how to send a message from telegram.link by the way
1- i declare var telegramLink = require('telegram.link')();
and create client (client.isReady()return true)
2-then i call client.createAuthKey()and it return a key(when i have to use AuthKey? )
3-but client.auth.sendCode()doesn't send any cod for my mobile number('+98939...5241')
pleas help me that how can i send a message to a phone number with this
thanx for every thing and sorry for that my English is not well(-_-).....
Codes....
app.get("/createAuthKey" , function (req, resp, next) {
console.log("Get_createAuthKey") ;
client.createAuthKey(function(e){
console.log(e);
console.log('createauthkey')
fs.appendFile(process.cwd() + "\createauthkey.txt" , "\n--------------------- \n "+ e, function(err){
if (err) {console.log(err) ; }
else {
console.log("append createauthkey! :D ") ;
}
})
})
resp.end("createAuthKey");
}) ;
////////////////////////////////////////
app.get("/SendCode" , function (req, resp, next) {
console.log("Get_sendCode") ;
client.auth.sendCode('+98939....5241',0,'en',function(e){
fs.appendFile(process.cwd() + "\sendCode.txt" , "\n------------------------ \n "+ e , function(err){
if (err) {console.log(err) ; }
else {
console.log("append sendCode! :D ") ;
}
})
})
resp.end("SendCode");
}) ;
///////////////////////////////////////////////////////////////////////
app.get("/SignIn" , function (req, resp, next) {
console.log("Get_sendCode") ;
client.auth.signIn('+98939...5241',req.body['phone-code-hash'],req.body['phone-code'],function(e){
fs.appendFile(process.cwd() + "\SignIn.txt" , "\n------------------------ \n "+e , function(err){
if (err) {console.log(err) ; }
else {
console.log("append SignIn! :D ") ;
}
})
})
resp.end("SignIn");
}) ;
////////////////////////////////////////////////////////////////////
app.get("/SendMessage" , function (req, resp, next) {
console.log("Get_SendMessage") ;
var peer = new telegramLink.type.InputPeerContact({
props: {
user_id: 98939...5241
}
});
client.messages.sendMessage(
peer,
'My UTF8 first msg!!',
3571334511 // random id...
).then(function (sentMsg) {
console.log('sentMsg:', sentMsg.toPrintable());
fs.appendFile(process.cwd() + "\\sentMsg.txt" , "\n------------------------ \n "+sentMsg , function(err){
if (err) {console.log(err) ; }
else {
console.log("append sentMsg! :D ") ;
}
})
});
resp.end("SendMessage");
}) ;
////////////////////////////////////////
Add support for messages.sendMedia and other file related operations, like geochats.sendMedia, upload.saveFilePart, upload.saveBigFilePart and upload.getFile, and all the data types associated to InputMedia and InputFileLocation.
/home/omid/Documents/test2/.meteor/local/isopacks/npm-container/npm/node_modules/telegram.link/node_modules/telegram-mt-node/lib/net/encrypted-rpc-channel.js:75 W20160218-11:19:25.870(3.5)? (STDERR) var buffer = zlib.gunzipSync(packedData); W20160218-11:19:25.870(3.5)? (STDERR) ^ W20160218-11:19:25.873(3.5)? (STDERR) TypeError: Object [object Object] has no method 'gunzipSync' W20160218-11:19:25.874(3.5)? (STDERR) at checkIfGzipped (/home/omid/Documents/test2/.meteor/local/isopacks/npm-container/npm/node_modules/telegram.link/node_modules/telegram-mt-node/lib/net/encrypted-rpc-channel.js:75:27) W20160218-11:19:25.874(3.5)? (STDERR) at [object Object]._onTimeout (/home/omid/Documents/test2/.meteor/local/isopacks/npm-container/npm/node_modules/telegram.link/node_modules/telegram-mt-node/lib/net/encrypted-rpc-channel.js:67:28) W20160218-11:19:25.874(3.5)? (STDERR) at Timer.listOnTimeout [as ontimeout] (timers.js:121:15)
My Nodejs version is 5.6.0 and I use it with meteorhacks:npm in my Meteor app.
It seems the problem is about zlib
Hello guys....
i keep getting "Client not ready!" error with the code bellow....
var telegramLink = require('telegram.link')();
var os = require('os');
var client = telegramLink.createClient(
{
id: 11111, //some id
hash: '111111111111111111111111', //some hash
version: '1.0.0',
lang: 'en',
deviceModel: os.type(),
systemVersion: os.platform() + '/' + os.release()
},
telegramLink.PROD_PRIMARY_DC,
function(ex){
if(!ex) { console.log('Connected to Telegram!'); }
else {console.log(ex);}
}
);
var peer = new telegramLink.type.InputPeerContact({
props: {
user_id: 'userID'
}
});
client.messages.sendMessage(
peer,
'My UTF8 first msg!!',
'9876543211' // random id...
).then(function(sentMsg) {
console.log('sentMsg:', sentMsg.toPrintable());
});
hi
i try to save authKey in my system and then i use telegramLink.retrieveAuthKey method to get my authKey back and it doesn't get null, it return real authKey and i make new client with this authKey
but when i try to get information like calling 'client.messages.getDialogs' method
but print this in terminal:
[INFO] Sun, 28 Aug 2016 22:38:17 GMT net.EncryptedRpcChannel Call of 'mtproto.service.invokeWithLayer' took 1299ms
[INFO] Sun, 28 Aug 2016 22:38:17 GMT net.EncryptedRpcChannel Wrong server_salt in message [0x57c367d88ac07c18]
[INFO] Sun, 28 Aug 2016 22:38:18 GMT net.EncryptedRpcChannel Call of 'mtproto.service.invokeAfterMsg' took 477ms
and stop working
why this happens and what can i do?
Hello.
I can't install it in my project!
Error:
npm ERR! code ENOGIT npm ERR! No git binary found in $PATH npm ERR! npm ERR! Failed using git. npm ERR! Please check if you have git installed and in your PATH.
HI,
I get the the feedback "phone_registered = false" when sending code2phone.
But my phonnumber is regsistered. Im using Desktop and Android client.
Any idea?
THX.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.