Telegram bot livecheck or how to get bot's chat id - telegram

Can I use telegram api for the bot live-check automation? There are dozens of bots created by a third-party service so I cannot modify their source code, but I've their names and tokens.
I thought I can create a bot who will send messages to others bots, but I can't find any info of how to obtain bot chat id.
So the question is how to obtain bot chat id to write a message to him from another bot. Or how to health check telegram bots.

Telegram bots do not receive updates from other bots, otherwise this could lead to infinite looping.
Why doesn't my bot see messages from other bots

Related

Send message to Telegram contact or list of contacts using API

I have a Telegram account and Now I wants to import list of contacts into my Account using Telegram API.
Is This possible to send Message to my imported contacts using Telegram API, just like normal user can send message to other user in his contacts list?
I tried Telegram bots but Telegram bot can't send message to other users, unless they started any chat with Bot. So this is not that useful.
You can act as a normal user by using the Telegram MTProto API. There are many libraries that interact with that, like Python telethon or PHP MadelineProto.

Can a Telegram bot read his own messages on a channel

I'm trying to figure out why my bot is not aware of his own messages on a channel, when I use bot.get_updates() I receive only messages written by me and not by the bot.
According to the python-telegram-bot API description, getUpdates fetches the messages sent to your bot, not the messages your bot sent. So it is intended behaviour that getUpdates would not be aware of the messages sent by your bot.
As a sidenote, as stated in the Telegram Bots FAQ, Telegram bots cannot access messages sent by other bots, regardless of the settings.

How can I get registered users in a Telegram Bot using the API

I'm writing a bot for telegram. I'm wondering what if I loose the user_id and the corresponding chat_id of registered users of my bot.
Is there anyway to ask telegram bot, which users or chats are joined to the bot? I didn't find any clue in the API
You need to log yourself, I asked #BotSupport same question too, seems Telegram won't make this API.

telegram bot api - get all messages in a group

I'm working on Telegram bot api in my java application. I have created a super group and add my bot to this as an administrator. I want to get all messages in that super group(not deleted messages) via bot. Is there any useful method for doing that?
Yes. first, you should "disable" privacy of your bot so it can access to all messages in groups. second, use getUpdates to see recent updates and user messages will be there.

Automate posting messages to a Telegram channel via API

I am new to the Telegram API.
I would like to automate posting messages to my public telegram channel.
I read a few posts that with bots I can achieve this, but I am not sure if that's the best way and whether the API has an option to directly post to a channel.
I would like to get some start points on how to achieve this?
Which API should I use?
Whether I need a dev account or bot, etc?
You can use bots to send message to channels. But there is some limitation, like size of files.
create your bot, by sending message to #botfather
add the bot to your channel. stackoverflow
write a code to send message to your channel. bot api
After 1 year of working with telegram API, I wanted to update this answer for best possible ways to interact with telegram API.
For posting to channels, both telegram API and telegram bot API can post to channels.
I worked directly with both the APIs, but I found the following clients for telegram API and bot API to be faster and easier to interact with telegram.
Telegram API client:
https://github.com/LonamiWebs/Telethon
Telegram bot API:
https://github.com/python-telegram-bot/python-telegram-bot
It is impossible to read messages from Telegram channels using Telegram Bot API.
In order to be able to scrape messages from Telegram channels that you do not own, you need to develop you own Telegram client that is capable of:
Joining your desired channels by links
Forwarding messages, arriving to the channels your client is subscribed to, to your own Telegram channel
In order to develop your own Telegram client, you need to use some implementation of MTProto.
You can find a lot of implementations of MTProto on https://github.com using mtproto keyword.
A few examples of well-documented implementations:
In PHP: https://github.com/danog/MadelineProto
In Python: http://github.com/LonamiWebs/Telethon
But probably it would be an overkill to develop your own solution to this problem if the only thing you want is to have several redirections from existing Telegram channels to your own channel.
There are applications that provide such a service.
For example, there is MultiFeed Bot from telespace.me team:
https://telespace.me/apps/multifeed_bot
It allows you to setup forwarding of messages within Telegram as well as redirections to external services.

Resources