is there a way to setup a listener for a Telegram Bot? - telegram

I would like to listen to a Telegram Bot message -the Bot is sort of a weather Bot, and on every new message, I want to get that message- in a programmatic way.
I tried to use another Bot but Telegram doesn't allow interaction Bot-to-Bot!
I will appreciate any help.

Converting my comment to an answer as OP requested to eleborate it.
I would like to listen to a Telegram Bot message in a programmatic way
This is not possible using the Telegram Bot Api. As you already mentioned, Bot-to-Bot interaction is impossible at this point.
Of course, there are a few ways of achieving your desired outcome, I'll mention 2 of them:
Alter the bot you want listen to, let the Bot trigger a custom endpoint/script that will fit your needs
Using the official Telegram TDLib API, you can create your own Telegram Application, this way, you can programmicaly preform any action that a regular Client might do, this include 'listening' to messages from Bots and triggering any kind of webhook to fit your needs

Related

Is it possible to get all my chat ids in telegram bot api?

I'm writing a bot that will send the same message for many people I've ever communicated in telegram. So I need to get all my old chat_id's.
All I found is just to store chat_id when I receive a new message as here Retrieve all chat ids using Telegram bot
But it doesn't fit me. If is it possible, please tell me, I'd really apreciate it!
It's not possible, as there is no such method listed in the Bot API Docs.

Can another telegram user make me access his bot?

My friend has a tranding bot made with BotFather.
Is there a way to make the bot shared betweeen our account in a way we can use it together?
Bot usernames are unique to each Telegram account and only that account is able to change the settings of the bot.
But you can make use of a bot through its API_TOKEN which you can get from botfather.
It looks like this:
300123900:BARsAbMYBJv5wFhzNJ-Gbx678qpln7IgvzI
If you share the token with anyone, they can use your bot. They will receive an error if they try to use it at the same time (calling getUpdates method from more than one instance would reject the caller except for the first one).
If by sharing you meant using the bot (not developing it), you can't do that unless the bot's developer designs it in a way that multiple Telegram accounts messaging the bot are considered one account.

Telegram bots not responding

I have created some new telegram bots to test their functionality. I haven't used them before, but I cannot seem to get them to respond to any commands?
Has anyone come across this issue before?
You have created a telegram bot on telegram. However..
Did you set any webhooks for the bot?
You should set a webhook/polling and write a backend to make it response to your queries.
For reference you can start from here
https://core.telegram.org/bots/api
set the webhook for your bot.
Ex:
http://api.telegram.org/bot<TOKEN>/setWebhook?url=<ENDPOINT>

Clearing Group Messages in Telegram using the BOT API

I need to be able to delete self generated messages by my bot automatically, or clear the entire channel's messages for that matter.
I'm not quite sure I saw anything useful in the Documentation. Is that possible?

Automate setcommands in Telegram

Is it possible to automate the setcommands command?
Instead of going to Botfather. Is there any way to doing from my code using Telegram API or anything else?
Telegram Bot API currently doesn't support interacting with other bots. If you really need adding commands to your bot programmatically, go through Telegram API (Don't confuse it with Bot API. This API is used for creating telegram clients, not bots) and contact #BotFather.
However, doing that doesn't seem reasonable. Instead, there might be a simpler approach so you don't need to add commands to your bot programmatically.

Resources