Create new telegram chat using bot - telegram-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

Related

How does telethon judge whether the chat is a group or a user? for bot

What I need is the type of this chat message, whether it is a personal conversation or a group conversation, not the interlocutor (I don't know if I say this, can you understand what I mean
https://docs.telethon.dev/en/stable/modules/custom.html?highlight=group#module-telethon.tl.custom.dialog
async for dialog in client.iter_dialogs():
if dialog.is_channel:
....
I looked through the documentation to find this, and after using it, it shows "telethon.errors.rpcerrorlist.BotMethodInvalidError: The API access for bot users is restricted. The method you tried to invoke cannot be executed as a bot (caused by GetDialogsRequest)
"
#lonami,
Is there any other way?
iter_dialogs method is only for user clients not for bot clients and you can use
await client.get_entity(<id or username here>) which gives your info about whether the id belongs to user or a chat or a bot.

Telegram bot. Private messages to group members

There is a public telegram chat. I want to make it so that when a user joins a chat group, the bot will send that user a private message.
I checked the technical capabilities and realized that this cannot be done, but I could be wrong. To implement this feature, the user must run this bot, then such an opportunity will appear.
Question. How to make it so that before joining a chat group, a person has to launch a bot?
First, you can get an array new_chat_members of new users in the chat from Message. Then you can send a Message with button (InlineKeyboardButton). This button has a switch_inline_query_current_chat field. That's what you need.

Telegram Bots: Can I now start a chat or not?

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).

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

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."

Telegram : How can show welcome message for new join bot

I create new bot in telegram bot ,and do steps like here :-
https://core.telegram.org/bots#
But now i need when any new user join in my bot, i need to show him welcome message.
How can do that ?
Use /setdescription and /setabouttext #BotFather commands
You must send these commands to #BotFather
/setdescription
then send your bot id like:
#example_bot
and send you welcome message
Welcome to my bot
You need to implement the /start command in your bot realization - set the welcome message.
And you should describe this command in chat with #BotFather via /setcommands for your bot.
After that when user adds your bot, the /start command fires automatically, and he will see the message you implemented.