Is it possible to pin a message using the Telegram API? I would like to create a bot to pin messages in a chat group. I was unable to find an specific method to do it in the documentation:
https://core.telegram.org/bots/api
Is there any way to do it?
Thanks.
you should first turn off the group privacy mode of your bot in your BotFather panel.
then, your bot should be the admin of that chat in order to be able to pin messages.
finally, you can use pinChatMessage, unpinChatMessage to do the task.
Related
I'm trying to create some sort of live chat widget, but with a Telegram bot instead of a real person on the other side. I don't know if it is possible, but ideally, there is a chat window that can be implemented on a website, and establishes a new connection with a telegram bot once you click on it. The end-user should NOT have a Telegram account. I already tried to implement Intergram but it's not exactly what I'm looking for, as it merely forwards the message to a human using webhooks, and the bot is only used as a message broker. I have heard that some customization is possible using tdlib but I'm not sure if it can help me achieve the desired result.
How should I start implementing a chat window with my bot on a website?
Is there a way to read the data from the chat messages in DM or Group with out adding the bot the DM or Group?
Similar to the APIs that are available to programmatically access the google drive, is there a way ?
Answer:
No, there isn't.
More Information:
The only API access you can get for Hangouts chat rooms is by using a bot. You can also use a webhook, but this is only for sending messages and not receiving.
You will need to use a bot to be able to do this.
https://core.telegram.org/bots clearly says:
Bots can't initiate conversations with users. A user must either add them to a group or send them a message first.
But if I visit https://telegram.org/blog/login it says
Telegram bots are a powerful communication tool, but until today they couldn't start a conversation. Even if you wanted them to reach out to you, you had to chat them up first.
With the new login widget, moving from interacting with a website to a conversation on Telegram becomes completely frictionless.
So it is somehow possible to start a conversation via the login widget. But how do I do it?
I get a user id. Is there an api endpoint to initiate a chat with the user?
The only way to begin conversing with a Telegram bot is to start the conversation with them yourself. There's no way for the bot to start a conversation with a user themselves.
As you said, telegram clearly says there is no way for bot to start a conversation, the only thing bots can do is sending messages to an old conversation (I mean a user have to start the conversation).
I created a new Telegram Bot which maintains a simple list. When I chat with the Bot directly (in PMs) the Bot works as intended.
I created this bot for a group of friends, so I added the bot to the group, and now, whenever I execute a command, the bot responds, but also repeats my command. Is there any way to avoid this behavior?
I am using the python-telegram-bot API and sending messages using update.message.reply_text('My message')
Is this just intended behavior or is there any way to avoid the bot repeating the sent command?
The bot only is replying message, not creating 2 messages.
You should use send_message.
I found the solution. Telegram API understands this as quoting, and is enabled in groups by default, disabled in private chats.
It can be disabled by using:
update.message.reply_text("message", quote=False)
I am using telegram bot api to get the chat history of a channel https://api.telegram.org/botXXXXXXXXXXXXXXXXXX/getupdates
my bot attached to the many channels and my query is that how to get chat history of any specific channel which is using my bot.
but when I am using getupdates method it shows all the message with all channel.
my query is how to get the solution using telegram bot API?
just like when we need to send a message to any specific channel using the used the https://api.telegram.org/botxxxxxxxxxxxx/sendMessage?chat_id=#channel id&text=message
i need a solution where I can send channel id and get the specific channel chat history using telegram bot API
my bot attached to the many channels and my query is that how to get
chat history of any specific channel which is using my bot
You cannot get the chat history of a channel using the bot API. However you can use the core API (tdlib e.t.c) to get the chat history. Alternatively you can try and scrape from the posts widget, but that is going to be too tedious.
but when I am using getupdates method it shows all the message with all channel.
You can manually filter out the channels since the ID is always in the Update object. I would suggest you use a library for this since it would be easier to implement the logic.