tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.11k stars 1.44k forks source link

Handle phone number links #2266

Closed umelikhau closed 1 year ago

umelikhau commented 1 year ago

Hello,

I need to handle phone number links: when I click on ‘https://t.me/+123456789’ I want my app to directly open the chat.

Which method from tdlib can I use to get chatId by phone number link?

levlam commented 1 year ago

All links must be handled by calling getInternalLinkType first and then following documentation for the returned type. For the link result will be of the type

//@description The link is a link to a user by its phone number. Call searchUserByPhoneNumber with the given phone number to process the link @phone_number Phone number of the user
internalLinkTypeUserPhoneNumber phone_number:string = InternalLinkType;
umelikhau commented 1 year ago

I'm not able to find neither 'internalLinkTypeUserPhoneNumber', nor 'searchUserByPhoneNumber'.

I'm using TDLib for Android in a prebuilt form downloaded from Build instructions.

Is there a newer prebuilt version available? Or should I build the latest TDLib by myself?

levlam commented 1 year ago

You need to build the latest TDLib using the example.

Flohack74 commented 1 year ago

@levlam searchUserByPhoneNumber is also not in the web page documentation. Was this a recent addition? was the function name different before?

levlam commented 1 year ago

The feature was added after 1.8.0, so it isn't present in the on-site documentation.

Flohack74 commented 1 year ago

Ok we are on 1.8.2 now so it should work? :)

levlam commented 1 year ago

Yes.