naoxink
naoxink

Reputation: 597

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

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

Upvotes: 17

Views: 33816

Answers (5)

philbv
philbv

Reputation: 41

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
}

Upvotes: 4

Evan Langlois
Evan Langlois

Reputation: 4361

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/

Upvotes: 1

Besto
Besto

Reputation: 388

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.

Upvotes: 1

Anton
Anton

Reputation: 488

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.

Upvotes: 2

Cracker0dks
Cracker0dks

Reputation: 2490

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.

Upvotes: 5

Related Questions