Telegram users can make it easy for others to contact them or find their public groups and channels via usernames: clients can also assign multiple collectible usernames to accounts, supergroups and channels they own.
Schema:
username#b4073647 flags:# editable:flags.0?true active:flags.1?true username:string = Username;
updateUserName#a7848924 user_id:long first_name:string last_name:string usernames:Vector<Username> = Update;
user#8f97c628 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector<Username> = User;
channel#83259464 flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true join_to_send:flags.28?true join_request:flags.29?true forum:flags.30?true flags2:# id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector<RestrictionReason> admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int usernames:flags2.0?Vector<Username> = Chat;
---functions---
account.toggleUsername#58d6b376 username:string active:Bool = Bool;
account.reorderUsernames#ef500eab order:Vector<string> = Bool;
bots.reorderUsernames#9709b1c2 bot:InputUser order:Vector<string> = Bool;
bots.toggleUsername#053ca973 bot:InputUser username:string active:Bool = Bool;
channels.toggleUsername#50f24105 channel:InputChannel username:string active:Bool = Bool;
channels.reorderUsernames#b45ced1d channel:InputChannel order:Vector<string> = Bool;
channels.deactivateAllUsernames#0a245dd3 channel:InputChannel = Bool;
Collectible usernames work just like basic @usernames, they appear in Global Search results and have deep links », just like basic usernames.
The ownership of collectible usernames is secured by TON, a fast and scalable blockchain network. They can be bought and sold through the Fragment platform », giving a simple and secure way to acquire and exchange valuable Telegram domains.
On the Fragment platform, clients may associate or dissociate purchased collectible usernames either to their Telegram account, or to a bot/channel/supergroup they own.
If any collectible username is associated to an account, channel or supergroup, user.username
and channel.username
won't be set, and user.usernames
and channel.usernames
will be set, instead: these fields contain an array of username constructors, which indicate whether a certain username is a basic username (editable
is set) or a collectible username (editable
is not set); and whether a collectible username is active
or not.
The first username in the usernames
vector must be shown in-UI as the main username.
Immediately after association, a username is marked as not active
(i.e. only the owner can see it in the usernames
list): use account.toggleUsername, bots.toggleUsername or channels.toggleUsername to mark it as active.
Note that you can't mark as inactive the basic (non-collectible) username, if any.
channels.deactivateAllUsernames may also be used to mark as inactive all collectible usernames associated to a certain supergroup or channel: useful for example when making a group or channel private, by first invoking channels.updateUsername with an empty username to remove the editable username (if present), and then invoking this method to remove all associated collectible usernames.
Use account.reorderUsernames/bots.reorderUsernames/channels.reorderUsernames to change the order of the usernames associated to an account, channel or supergroup: all currently active usernames must be specified.