Telegram bot: ChatId ? Not getting ChatId but {"ok":true,"result":[]} - telegram-bot

tried all the options as described in Telegram bot - how to get a group chat id ? Ruby gem Telegram_bot.
When browsing to : https://api.telegram.org/botXXX:YYYY/getUpdates, all I get is:
{"ok":true,"result":[]}
What am I doing wrong?

try to send some massages to the new group.so there is some results to show. that worked for me

This works:
How to obtain Telegram chat_id for a specific user?
"I created a bot to get User or GroupChat id, just send the /my_id to telegram bot #get_id.
It does not only work for user chat ID, but also for group chat ID.
To get group chat ID, first you have to add the bot to the group, then send /my_id in the group."

Related

How To Get Telegram Bot ID?

Anyone Who Add In My Group, I Want To Greet Them With My Bot! But After Some Time I Want To Delete That Bot Messages Too... For That I Need Bot Chat ID. So From Where I Can Get It?? The Bot Is Created With BotFather!
To delete messages, you only need the chat_id of the chat the message was sent in and the message_id of the message. See deleteMessage, you don't need the user id of your bot. If you need that for some other reason, you can get the via getMe: The return value is a User object that has the id field.

Is that possible a telegram bot can remove messages from group

i want create telegram bot .
It can join to the group and delete messages in group .
Is that possible a telegram bot can remove messages from group ?
i search and some people say yes it possible , some people say no
Check this link out, it seems the new bot API made it possible with some restrictions:
https://core.telegram.org/bots/api#deletemessage
The following details are from telegram API page:
A message can only be deleted if it was sent less than 48 hours ago.
Bots can delete outgoing messages in groups and supergroups.
Bots granted can_post_messages permissions can delete outgoing messages in channels.
If the bot is an administrator of a group, it can delete any message there.
If the bot has can_delete_messages permission in a supergroup or a channel, it can delete any message there.
Returns True on success.
This is now outdated, please see Darkc0d3r's answer
Using the Telegram Bot API? No, there is no such functionality as of now.
However you can if you are using the Telegram API, where you can use the messages.deleteMessages method, which requires you to give it a list of message id's as a parameter.
You can use
bot.DeleteMessageAsync(chatId, messageId)
you should make it in a try catch in case the message doesn't exist anymore or you have a wrong messageId,
messageId is a property which you get in MessageEventArgs.Message,
Note: the chatId should be the Group/Channel chatId and not of the user who sent it, get that in Chat.Id property of MessageEventArgs.Message ...

Create new telegram chat using bot

Can Telegram bot answer to a single user from the group if this chat (user with bot) wasn't created before? In other words I need to create a new chat with user.
Method ...sendMessage?chat_id=$userId... works only when the user has allready chatted with the bot once.
Sorry, I didn't notice, the server retuns:
{
"ok":false,
"error_code":403,
"description":"Bot can't initiate conversation with a user"
}
Unfortunetly nope

How do I get the group ID and chat ID with telegram inline bot?

Does any of you guys knows how #like telegram bot works?
When I call it in a group using inline, then select to make a new post, it forwards me to the bot chat, and when I finish, it forwards me back to the group I was. So it must have the group ID somehow.
But accordingly to the API docs, that's not possible.
I tried some tests and all I get is the user ID (as chat ID)
I want to be able to call a inline bot from a group, and then forward it to the bot chat with the user ID and the group ID. It seems that the #like bot does that, but I don't know how.
Can someone help me?
So I find out the solution! There is a special mechanism for returning from where the bot was called:
https://core.telegram.org/bots/api#answerinlinequery the last two parameters
https://core.telegram.org/bots/api#inlinekeyboardbutton the last parameter

can Telegram Bot sends message to group?

I create a group on Telegram and created a bot and add in.
I am trying to send a message to group that I created and the error shown as below
{"ok":false,"error_code":403,"description":"[Error]: Forbidden: can't write to chat with deleted user"}
I have use getUpdates from Bot Documents and managed to get chat id and doesn't work again for me. p2p (private type message) works for me but not group type.
Any advice please? Thank you.
Yes you can, you have to invite the bot into the group, grab the chat_id of the group and send the message as you are sending a normal message to a private user.
The error message is self-explanatory tough.