Python-telegram-bot Get old messages in chat within two timestamps - linux

How can I get old telegram messages?
*I'm saving interesting stuff found online via sharing these links to a Telegram bot.
I would like to make a "read it later"-like app, organizing these links into weeks.*
When I call the "bot.getUpdates" method, of course, I get -as expected- new messages.
What if I needed to get last week messages?
How can I get every message between two timestamps in the past using the python-telegram-bot API?
Thanks in advance.

Related

How to create a bot in lex/azure that respond in slack threads?

I have created 2 chatbots using AWS lex and Azure bot framework each. I have integrated them with slack and they respond to the mentions in channels.
Currently, the bot responds as a new message however I want it to respond in the slack thread of the original message posted by the user. I tried to look for articles in various places but could not find anything helpful. Does anyone have any idea on how to achieve this or a reference to a GitHub repo for a sample?
Since you are able to post replies, I am assuming that you are using chat.postMessage API.
https://api.slack.com/methods/chat.postMessage
To send the reply as a thread, all you need to do is that add thread_ts argument in the api call.
(Provide original message's ts (timestamp) value to make this message a reply.)

How to make twitter bot track tweets from our followers?

I was making a twitter bot with Twit, I found making tutorials using T.stream('user')
to get stream data about our account, now its deprecated. So in 2021, how can i achieve these?
requirements:
Know when someone follows my bot, and make a thanks post.
Know when someone in my followers list or following list makes a tweet.
Also I have a doubt, when we use stream, old data is also coming, so how exactly stream works? if i only want latest tweets, I have to sent get by setting interval?
For the new followers, you will need to build something using the Account Activity API, which uses webhooks to send you event messages. You will need to filter for the follow events.
For new Tweets from people you are following, you will need to poll the home timeline endpoint. There’s no realtime method for this.

Discord bot read all messages received when offline

I'm creating a discord bot that I would host with my PC so only some hours per day and I'm searching something that allows the bot to read all dms that he received while offline or similar.
I had two ideas to do this.
The first and simpler
call an iphotetic function that collect all the messages that the bot received when it was offline
The second
save the date when the bot goes offline
when it goes back online take all the 'open' private chats (so the ones that contains at least one message)
parse all the messages received from when it went offline to when it came back online
Right now I couldn't find anything on how to do this, any ideas?
Discord seems to have some nice looking api docs that are 100% covered by the discord.py library. I'd dig around there for a bit and see if you can achieve what you are looking for with it. Something as simple as a text file would work to store persistent data, maybe a timestamp or the last message id before the user logged off.
Both your ideas seem decent to me, I'd say just try building them and see if you run into any road blocks. By the time you do you will have a better understanding of the capabilities and limitations of the api and will be able to create a better plan.

sending direct messages from nodejs script to telegram

Is it possible to send a message from a node.js server to someone's mobile number or telegram Id directly?
is it possible without using a telegram bot?
I need an API like below:
function sendMessage(senderTelegramId, receiverTelegramId, messageText)
In short: No, without a bot no way for now.
Detailed explanation:
In order for you to send users messages on telegram you would need to create your own telegram bot. They have a well documented API which you can read and play around with.
There are 2 things you should know about sending messages to users using telegram bot:
You can't just send random people messages on telegram even if you know their phone number, to send them messages you need to have their chat_id. See how in the docs
To get the chat_id the user must first click the start button that comes up when they open your bot for the first time. Telegram will send you the chat id of that user and you save it for later when you would want to send messages to that user.
There are tons of libraries that makes working telegram bots very easy, it wouldn't take you more than an hour to get started.
I hope this answers the question, feel free to ask further questions, I have made some bots and you can also play around with them to see how it works.
Cheers )
There is actually one more easiest way to send a message to chat
just fetch the URL
https://api.telegram.org/bot[BOT_API_KEY]/sendMessage?chat_id=[MY_CHANNEL_NAME]&text=[MY_MESSAGE_TEXT]
you can find more details here
https://xabaras.medium.com/sending-a-message-to-a-telegram-channel-the-easy-way-eb0a0b32968

How to read a message from a bot via telegram API?

I have a room with a couple of bots, one of them needs to read all the messages on the room including other bot's messages.
Telegram API says bots can't see other bots message otherwise they might get caught in a "loop".
Since i really need to work around this i'm wondering if there is a known workaround?
There cannot be any workaround using the Bot APIs since the messages in getUpdates or webhook of the Bot will be from Users alone.
One workaround could be to use the telegram-cli and create a normal user as a Bot.

Resources