Telegram Bulk Messaging Limitation - python

this Platform is really really helpful. My issue is that is it possible to send 500k promotional messages per day? I have the script ready using the API # and API ID using Telethon. But anytime i try to send Messages, the accounts get banned. Maybe it got banned because i was on the same IP Address while scraping the users and sending messages. But what I really need to know is that is it even Possible to send 500k messages in day, if yes:
How many Accounts are needed(where can I get these number of
accounts from)?
Do I have to manually create accounts and receive
OTP's for each or is there a script ready for that as well that I
can implement?
What should be the duration between each messages and
how many messages from one single account.
How to shuffle between accounts while send messages? Manually or is there again a script
ready for it?
Please guys I really really need help. If not 500k how many can i send per day maximum.

You can send up to 20 messages per second in the same chat on Telegram.

Related

Telegram : how to get the total unread message count?

For one of my projects, I need to fetch in real-time the total unread count of telegram messages
As shown under, it's possible to do it in Telegram Desktop client :
https://telegra.ph/file/d58a4c36084d79781f89c.png
it's also possible to show it on other clients
so, I wonder how I can simply do it
maybe through the Telegram API, however I didn't find anything related to this
(we can get unread mentions and unread reactions, but only for a specific chat)
An integration in python would be the best for me, as I don't really master other languages yet
NB : "fetch in real-time", not needed to have it every millisecond, but maybe each 2-3 seconds

Waiting in a Django View For a Webhook or Timeout

I am using WhatsApp official API to send messages to customers. I want to send them a reminder message if they have not replied during a certain period of time (a couple of hours more or less). In other words, I will send a message and wait for a certain period of time for their response. If they respond, no reminder message is needed. If they don't, I will send them a reminder message. WhatsApp API sends webhook notifications when they reply.
How do I implement that in a Django view? I am thinking of creating an async process/thread each time I want to wait, and handle the timeout condition in that process somehow. Is this the right approach? I think that would be costly in terms of server time used, but I am not sure. If this is the right approach, please show some pseudo-code on how it can be done.
I will be deploying my app on Heroku.
Your answer is much appreciated..

Is it possible to use aiogram to send messages without handlers?

Recently I've been writing bot which parses site and sends message to users, whenever new information appears. Is it possible to make it on aiogram? Thank you for your answer in advance
Yes. it is.
But you have to store user_id of your users, then when "information appears" you take from your storage user_ids and send message to each user. Also it is unreal to send message for all users in one time due to telegram limits (see here).

How to send emails according to user request in python?

How do i send an email whenever a user requests it?. I thought on a script that sends mails every hour with some content relevant for the recipients, but I dont like the idea of spamming mail to other people. So i would like to send this mail whenever the recipients wants it. For example if this user sends me a mail with a keyword, i would like the sript to run and send the mail back with the content already made up. So, there is no spam and information is sent in a more efficient way.
I appreciate your help in advance.
This is a pretty complex and broad question.
First off, you would need a server or your PC to have the script running all the time or periodically fire off via cron.
Secondly, you would need to keep some kind of job queue where you would register that a user has sent you an email requesting that you send them one in response. There are well developed and complex job queues like Celery, but you could potentially do with something less complex - maybe a Google Sheets table.
Thirdly, you would need to parse emails you receive in order to get the keywords and email addresses. If you go the gmail + google sheets route, you could do it with some custom code probably, but otherwise you would need to implement email checking on your PC or server. Once you parse them, you add them to the jobs queue.
Finally, you need to provide email access to your Py script - meaning SMTP login. The docs have more on this.
As you can see, there are a lot of things to consider and implement, so you maybe better off trying to narrow down your question a bit. :)

Telegram bot API limitations

If you open telegram bot FAQ you can see 1 message per second inside particular chat, 30 messages per second inside group chat and less than 20 messages per minute inside group chat.
I have simple telegram bot with simple rate limiter:
it doesn't use group chats;
it sends only 1 message per second inside particular chat;
it sends less than 20 messages per minute inside particular chat;
But i always receive 429 error:
"error_code":429,"description":"Too Many Requests: retry after 236"
I confused since i don't violate telegram limitations. Please, help me to find problem.
Source code here, bot uses this library for interaction with telegram in poll mode. Steps to reproduce:
1) python3 bot.py;
2) /start in bot;
3) click "Спектакли";
4) click very fast on "Трагикомедии" or "Драма";
Your msg_count seems is tracking sended messages for each private chat. But it should be global, beacuse its seems that your current code allows your bot to send a few messages per second to unlimited users. So it would probably exceed the limit.
If you're sending bulk notifications to multiple users, the API will
not allow more than 30 messages per second or so. Consider spreading
out notifications over large intervals of 8—12 hours for best results.
Telegram Bots FAQ

Categories