Sending message from telegram messenger bot to e-mail - telegram

I just need that my telegram bot would sent a message to my e-mail. For example, my bot has a form that user need to fill out, and I just want to get results from bot to be appeared in my e-mail. The form of the bot was developed in ManyBot. I have found several results on passing e-mail message into telegram

Related

How to send a Telegram message to a username using bot api or telegram api?

Hi I am trying to build a website login system where users are able to log in using their telegram. I would like to achieve this workflow:
User selects to login/sign up via telegram.
User enters their username (#ExampleJoe).
A 6-digit verification code is sent to them via my Telegram bot (#ExampleBot).
The user enters the received 6-digit code into my website and is allowed to enter.
I have issues with steps 2-3 where my bot can send them a direct message (not in a group chat) with only their username. I am aware that sendMessage method in the Telegram bot API requires a chat_id and that a user_id is also suitable. However, I do not know how to get the user_id with just the user's username.
That's not possible with the Bot API. You'd have to use a userbot for that. Note however, that TG provides a native login widget that you can use instead.

how to delete telegram service message after 60 sec sent by BOT

i want to delete service message sent by bot after 60 sec.
bot already admin of the group, and i use php for it
when i send
https://api.telegram.org/bottoken/sendMessage?chat_id=chatid&text=hello this is bot
it returns nothing as it sent from bot
but return parameters like message id, text when a user send a message in a group but nothing when bot sends any message
any way to delete the service message after 60 sec or something like rose bot or groupbutler in php command
The JSON response to your request will contain the JSON serialized message resulting from your request. Citing the docs:
On success, the sent Message is returned.

How to confirm if a phone number belongs to a user_id in telegram bot

I'm working on a project where the user enters their phone number on a website. And the conformation is done through a telegram bot, which the user initiates a conversation with first. The user sends the confirmation code displayed on the site to the bot.
So here is my question, is there any way that I can compare the phone number the user provided with the confirmation code message the user sent to the bot? Or is there any way that I can get the user_id from the phone number, the user provided, so that I can compare it with the message sent by the user?
You can send Keyboard with request_contact=True that will ask user to share phone number (documentation).
Then your bot can get an Update with it (example how to do that) and compare with desired phone number.

Can I use chat_id to send message to clients in Telegram bot after a period of time?

I want to say to clients to start my chat bot and send me username and password, then I store chat_id of them, and use it whenever I want to send a message to one of them.
Is it possible? or chat_id will be expire?
If the chat_id is the same as the Telegram user_id for that client, then yes you can.
SendMessage:
chat_id [Required] [Integer] Unique identifier for the target chat
text [Required] [String] Text of the message to be sent
If you want to identify each user with a unique constant you can use user_id.
user_id: User identifier in Telegram.
chat_id: Unique identifier for the target chat.
user_id and chat_id wil never expire or change on Telegram. But a user may use your bot from a private chat or from a group. You may get two different values from the same user. So i suggest you to use user_id to do that.
When a user register on telegram, server choose a unique chat_id for that user! it means the server do this automatically. thus if the user send /start message to your bot for the first time, this chat_id will store on bot database (if you code webhook which demonstrates users statastics)
The answer is if the user doesnt blocked your bot you can successfully send him/her a message. on the other hand if the user had delete accounted no ways suggest for send message to new chat id!
i hope you got it 😉

As a telegram bot, what is the best way to authenticate the owner of a telegram channel?

Is there a way for a telegram bot to know who is the administrator of a channel?
One way to do this is to send a verification code to channel admin and ask the admin to confirm the code. I couldnt find any API that allows sending a message to channel admin, though.
I can authenticate a user account just by asking user to send a message to my bot, but is there a way to have a channel sending a message to a bot?
i think this is not required!
when you have a1255412542_bot and ask the user to add this bot as administrator, is it possible to a channel admin to add this bot as admin?!!
you can:
ask the channel name,
send a message to the channel to ensure that the bot is not the admin of the channel,
ask the user to add your bot as admin immediately! then press ok button on your bot,
then you send a text message (or sendChatAction for hidden test) to the channel and if successful, finished!
You can get the list of admins of any channel using this method:
https://core.telegram.org/bots/api#getchatadministrators
Check the permissions of that user since it returns a json array of username of the admins and their permissions

Resources