What can I use to implement Telegram messages in my website?
Asked Answered
S

5

17

After searching all over the web, I am forced to ask: What can I use to send messages using the Telegram API? JavaScript or PHP preferably. I have a group of friends that I wish I could tell through certain events on the website.

Here's an interesting link: http://reyero.net/es/node/263

Update

Sukkoth answered 18/2, 2014 at 9:49 Comment(1)
Try to do the verifying and securing part via php, like logging in and generating a token for each user. You can then pass this along to the client to send messages. Verify the token each time a message has been received with php. As far as I know you can make the chatting a lot more fluit with jQuery and Ajax. This should net you a decent and secure service.Pfosi
B
5

Check this link: https://github.com/zhukov/webogram this is a chrome app using javascript.

API can found here: https://core.telegram.org/api

Other applications using the api can found here: https://telegram.org/apps

use the source luke :)

I would not do it in javascript because you have to give alle the authentication infos to the client.

Beseech answered 18/2, 2014 at 10:10 Comment(6)
I know those links. I was looking for an example or a framework to start using it without having to investigate other apps already done :/Sukkoth
I would also mention that the webogram thing has too much flaws right now. He states in his TODO list, that he needs to implement the Secure Messaging System. This tells me, he hasnt done the whole Security Checklist stuff yet. :) I would wait for some better implementations or you realy have Time to get all this encryption stuff. Once you get functions for this done, it should be pretty easy. And dont use too much JS for that. You need a Serverside Thing to do encryption correct. So your solution should be something with PHP or Python or something.Beore
@Beore I dont agree with you in the serverside php/phthon thing because its no END-TO-END encryption. So you have to use javascript for that.Beseech
@Beseech ok you are right in that. Didn't had that in mind. What i personaly was looking for, was an API implementation for some more closed purposes. If this is used as client a js solution may be the way to go.Beore
@Beore it seams there are no good libs out yet. Let us please know if you find one :)Beseech
@Beseech This depends pretty much on how the trend goes. As it looks right now Telegram has to compete with Threema. Imho, I thing Telegram is better due to its Open Sourcery. :) But they also have some work to do left. My intention was a way to Implement Telegram as additional Chat Service for a Website. It would deliver apps right away and reduces your Bandwith costs by outsourcing al the Data handling. But at least I could also develope a smaller Service on my own. This is why I cant guarantee to look at it, any time soon.Beore
L
4

Simple JS library to operate the calls to Telegram API servers using Javascript: https://github.com/sunriselink/TelegramApi

That's what you have been looking for, and me too.

Works this way (from the README.md):

telegramApi.getUserInfo().then(function(user) {
if (user.id) {
    // You have already signed in
} else {
    // Log in
}
Lues answered 4/2, 2018 at 6:33 Comment(4)
Thanks! Seems easy and well explained :)Sukkoth
@Sukkoth , actually, I've tried the one and it's hard to use it. It relies on very long list of internal Telegram dependencies.Lues
=> I've found another one which seems very useful: github.com/dot-build/telegram-jsLues
=> Here is an example of usageLues
P
2

You can use our REST API for Telegram at http://jaconda.im

It is much easier to use, because we take care of stability and deliverability of your messages.

Just create an account with Jaconda, and besides hundreds of services, you will be able to send and receive messages over HTTP.

Presumption answered 2/5, 2015 at 18:46 Comment(0)
M
1

I use NodeJS for a Telegram bot; with NodeJS you can use a webhook or some polling to retreive information that is placed in a website and take it back to Telegram in any format you like.

I use this particular code to extract an ever-changing dollar value (but the trigger is not the change but a command that pulls it; this, I hope, you can change if you want).

bot.onText(/\/dolar/, function (msg) {
    request('https://twitter.com/DolarToday', function (error, response, html) {
        if (!error && response.statusCode == 200) {
            var loadedHTML = cheerio.load(html);
            var contentContainer = loadedHTML('p.ProfileHeaderCard-bio').text();
            var soughtContent = contentContainer.substring(contentContainer.search("Bs."), contentContainer.search(" y el"));
            return bot.sendMessage(msg.chat.id, soughtContent); //outputs a value like `Bs. 1904,48`
        } else {
            console.log(error);
        }
    });
    console.log('Sent dollar value');
});

To do this you need three modules: node-telegram-bot-api for the bot interaction with Telegram, request for the http access and cheerio for the jQuery select and pull.

Maxinemaxiskirt answered 13/11, 2016 at 4:19 Comment(0)
Z
1

Install ChatBro module into your site. Set a few params, done. Even lets Google archive your chats to increase search results.

https://www.chatbro.com/en/

Zanezaneski answered 8/2, 2017 at 6:37 Comment(1)
That looks nice. I'll give it a try :)Sukkoth

© 2022 - 2024 — McMap. All rights reserved.