Search code examples
androidcontactstelegramtelegram-botsamsung-galaxy

Telegram send unsaved contact


Short: Is there any way to send phone number of unsaved contacts in telegram?

Long: I need to send unsaved contact to telegram bot like 20 times a day. I know, than I can open phone app > go to "recent" tab > click on unsaved phone number > copy it > switch back to telegram > paste it. Is there any way to send it automatically or simplify this process?

I am not asking you about fully working program. Just tell if it is possible or give me ideas.

So far, I found that it is possible to send my phone number to telegram bot via API. But can't find a way to send unsaved contact.

Also, telegram has built-in feature to send contacts, but it works only with telegram contacts, not with unsaved phone numbers.

So far, I came up with using auto clicker.

This may help you: My phone is Android device. I am using default Samsung phone app. And I have full control over that telegram bot.

Links:

Telegram API

Telegram API #2

Telegram API #3

Example of unsaved phone number in contacts app


Solution

  • You can send contacts using a code like below when you program in Telegram Bot API:

    await Bot.SendContactAsync(update.Message.Chat.Id, Phone_Number, "First_Name", "Last_Name");
    

    Here inside your own app (which could be telegram android bot) you can access your phone's call log and replace the Phone Number (which is a string) with phone numbers that your bot extracts locally.

    By the way, Last Name is optional in the code that I mentioned.