0
votes

I Have a problem in using Telegram APIs in C#. I want to create a contact in telegram with a specific phone number so i can send messages directly to a phone number that was not in my contacts.

How can i create a contact with specific phone number in telegram with c#?

I tried to use TLSharp to do this but i did not found any method.

2

2 Answers

1
votes

There is nothing for it in Telegram Bot API: https://core.telegram.org/bots/api

0
votes

TLSharp now has method ImportContactsAsync, you can use it like this:

var list = new List<TLInputPhoneContact> 
            {
                new TLInputPhoneContact() { Phone = phoneNumberTo, FirstName = defaultName, LastName = defaultLastname, ClientId = 0}
            };

            await client.ImportContactsAsync(list);

Wasted some hours trying to find how to do it in the internet, but hadn't found, hope it will help someone with the same problem.