Get Telegram API_ID and API_HASH programmatically - telegram

I'm trying to figure out how to get my Telegram API_ID and API_HASH using either Telethon or Pyrogram but can't seem to find anything on the internet so far. In my program, a user can sign up to Telegram programmatically (without having to use their real phone number) but for them to be able to do anything an API_ID and API_HASH are required but then the phone verification site won't give code for that old number since it's one time only.
One solution that comes to mind, is scraping the telegram site and simulating the log in, then reading the code sent to the client and using that to scrape the API_ID and API_HASH from the web page but that sounds like too much work right now as i'd love a simpler approach.
I hope this is as clear as possible.
Thanks in advance.

While Telegram's MTPROTO API Credentials are bound to a specific account, they represent an Application like Telegram Android, Telegram Desktop or Telegram WebK/WebZ. You can use the same pair of API_ID and API_HASH across multiple applications.

Related

Are "user" bots made with telethon allowed on Telegram?

I'm trying to make a bot for telegram using the telethon library. I would like my bot to be able to retrieve all members of any group that it's been added to which is not currently possible with the telegram bot API.
Because of this limitation, I made a new telegram account/app for my bot (using a Google Voice number) to use the python telegram Client, telethon, to gain user level access to the telegram API.
After playing around with it for a bit, I received this error:
telethon.errors.rpcerrorlist.PhoneNumberBannedError: The used phone number has been banned from Telegram and cannot be used anymore. Maybe check https://www.telegram.org/faq_spam (caused by SendCodeRequest)
After trying to login again from my phone I received a similar notification:
This phone number is banned.
I submitted a support ticket which was never responded to, but I was somehow able to login again with the Google Voice number the next day.
My question is: are we allowed to make bots for telegram with user level permissions using the telethon client? I cannot find any explicit rules about this in the telegram API ToS. However, the telethon docs mention in passing:
If your application ever needs user features because bots cannot do certain things, you will be able to easily login as a user and even keep your bot without having to learn a new library.
You're allowed to use any userbots. the ban probability is exact same as of an unofficial app of Telegram in Google play and other platform.
You're however going to be suspected and pre-banned by Telegram if you're from certain countries or you use VOIP phone numbers. Telegram doesn't like such numbers and might require you appeal to unban it manually.
It's fully their decision.
i, have been using my account in forks and userbots, etc.. for many years, so new accounts are suspected to be up to no good and frozen. try with your own number or buy extra legit one.
Telegram is pretty spammy platform and lately they have increased the ban situation.

Retrieve Telegram Premium Voice-To-Text from API

I’m doing kind of research trying to rate Telegram Voice recognition, to do that I need to get text Telegram outputs for certain set of voice messages. I do have Telegram Premium subscription and all I need to do now: somehow automatically (set is rather large) via API (maybe it is possible in Telethon?) make telegram transcribe my audios and in some way get all that recognitions back.
I’ve heard that Telegram uses just Google API, nevertheless point is to get recognitions directly from Telegram. Do you have any ideas of doing that?
TLDR: have set ~1-5k voice recording, want to get back recognitions from Telegram Premium Voice2Text feature
Thanks in advance!

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.

how to read/receive telegram channel messages in my telegram bot?

i'm trying to create a bot which can read/receive all messages in a specific channel and send them to me .
my problem here is that i can't find a way to access those messages in my bot
important thing is:
i'm not admin or creator of that channel
i don't want to ask the creator to add my bot as administrator
i've searched in google but i wasn't able to find a solution
and i'm also sure that it is possible to do it, because there are already some junction bots with exact same performance .
any references or suggestions are appreciated .
As already pointed out in the Telegram group of python-telegram-bot, bots can't receive messages from channels where they are not an admin. If you want something like this, you'll have to use a user bot, e.g. a program that controls your private Telegram account (in contrast to controlling a bot account). See here for some info on user bots.
Note that also the provider that you linked seems to be using userbots behind the scenes. More precisely, the docs on the so called "DirectConnection" state that you need to enter a phone number (associated to a telegram account) and then "Follow the instructions" which probably just means to enter the verification code that Telegram sends you. Phone number + verification code is exactly what is needed to control your private Telegram account.
Disclaimer: I'm currently the maintainer of python-telegram-bot.

Telegram Api - is there a way to add people to a channel/group using phone number instead username?

Actually my script can add people to group, using username. I wonder if it's possible to do the same using phone number.. Telegram api is not clarely about that. Thanks :)

Resources